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