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.
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.