Link to home
Start Free TrialLog in
Avatar of AhmedAliShaik
AhmedAliShaikFlag for India

asked on

Script for getting AD user information

Team,

I need to get the list of AD users in my domain with a criteria. If the custom attribute 1 and 5 are equal i should get the total number of users count.

get-user -Resultsize unlimited -organizationalunit mydomain.com/Users -filter {((customAttribute6 -like '76*') -and (customAttribute6 -like 'Vehicle*'))}| Measure-Object).Count

When executing the count i am getting the below error:

The term 'customAttribute6' is not recognized as the name of a cmdlet, function
, script file, or operable program. Check the spelling of the name, or if a pat
h was included, verify that the path is correct and try again.
At line:1
+ get-user -resultsize unlimited -OrganizationalUnit mydomain.com/users -Filter
(customAttribute6 <<<<  -like '76*')
    + CategoryInfo          : ObjectNotFound: (customAttribute1:String) [], Co
   mmandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Is there a way i can use custom attribute to retrieve AD users list.

Please help me in executing the cmd.

Thanks in Advance.
SOLUTION
Avatar of Krzysztof Pytko
Krzysztof Pytko
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AhmedAliShaik

ASKER

Krzysztof ,

I will try this and post u with updates.
Hi Krzysztof ,

I believe Get-ADuser is a Quest cmdlet.

I am able to resolve only get-user even no luck with the command.

Can u revise and give me a windows/Exchange powershell command for the same.
No, Get-ADUser is a Windows Server 2008R2 PowerShell module for AD. Do you have 2008R2 DC ? If not, which PowerShell version do you use ?

Krzysztof
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks you.