PowerShell Commands Not Working From Command Line RRS feed

  • Question

  • I run the following command in PowerShell and it works as expected:

    Get-ADObject -Identity "CN=UserName,OU=Users,DC=Domain,DC=com" -Properties GivenName, Mail, sAMAccountName, SN

    However if I run the command the following way, I receive and error:

    PowerShell.exe Get-ADObject -Identity "CN=UserName,OU=Users,DC=Domain,DC=com" -Properties GivenName, Mail, sAMAccountName, SN


    Get-ADObject : Cannot convert 'System.Object[]' to the type
    'Microsoft.ActiveDirectory.Management.ADObject' required by parameter
    'Identity'. Specified method is not supported.
    At line:1 char:24
    + Get-ADObject -Identity CN=UserName,OU=Users,DC=Domain,DC=com -Properties
    Giv ...
    +                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Get-ADObject], ParameterBi
        + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.ActiveDirectory.

    Please Help!!!

    Tuesday, May 20, 2014 3:11 PM


All replies