troubleshooting Question

Script for getting AD user information

Avatar of AhmedAliShaik
AhmedAliShaikFlag for India asked on
Active DirectoryShell Scripting
6 Comments2 Solutions614 ViewsLast Modified:
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.
ASKER CERTIFIED SOLUTION
Krzysztof Pytko
Senior Active Directory Engineer
Join our community to see this answer!
Unlock 2 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros