Is there a way to determine if an Organizational Unit exists in AD using the command line?
This could be done using a standard ldap search tool or the 'vastool search' options. These examples need to be run as root to use the host/ option. That could be swapped for other credentials however.
Example 1.
This command will search the domain for an OU called Users. It will return any OU's called Users.
/opt/quest/bin/vastool -u host/ search "(&(objectclass=organizationalunit)(name=Users))"
Example 2.
Alternatively if you are looking for a specific OU you can also use the distinguishedName attribute. That command could look something like this.
/opt/quest/bin/vastool -u host/ search "(&(objectclass=organizationalunit)(distinguishedName=OU=Users,DC=example,DC=com))"
© 2025 One Identity LLC. ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center