Link to home
Start Free TrialLog in
Avatar of cgooden01
cgooden01Flag for United States of America

asked on

Script to find Only empty OU and subOU's nested in a particular OU structure

Looking for the most accurate way to find all empty OU and nested Ones within my AD Structure. I dont want the entire forest/domain. Just inside a particular delegated OU.  I have tried many different ways, but when I do a cross-check of the data it is not accurate.  

Cannot use any Third Party tools.
Avatar of Emmanuel Adebayo
Emmanuel Adebayo
Flag of United Kingdom of Great Britain and Northern Ireland image

To count number of objects in an OU (and sub OU's): use the adfind command
i.e
adfind -b ou=<Require OU to search>,dc=<Yourdomain>,dc=com -f "(objectCategory=*)" -c
ASKER CERTIFIED SOLUTION
Avatar of Joshua Grantom
Joshua Grantom
Flag of United States of America 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