Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return All Users In An OU, given only OU Name

Status
Not open for further replies.

L8knight

Technical User
Apr 16, 2004
3
US
I have a HUGE AD Environment with hundreds of OUs. I have a need to be able to input an OU, search AD for that OU and then count all Active Users.
The problem I am having is finding the OU. I see tons of examples for Users and Computers, which is easy if you build the query manually (OU=bla,OU=bla,DC=...). But I just want to input "Indy", have the script search all of AD and find the OU "Indy" then return a list of Users that belong to that OU.
I thought the best way would be using ADO and filtering on the CN.

Just need some guidance, I'm just stuck at the OU part, I can manage returning active users once I figure out how to do the OU search.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top