Find the distinguished name of an AD object (DSQUERY)
This post got me out of a hole today so i have reproduced it here for posterity –
Command to find the LDAP path for OU
Dsquery OU –name "OU Name"
Command to find the LDAP path for group
DSquery group –samid "Group Name"
Command to find the LDAP path for user object
Dsquery user –samid "User Name"
Command to find the LDAP path for computer object
DSquery Computer –name "Computer Name"
Command to find the LDAP path for subnet object
dsquery subnet -name "Subnet"
Command to find the LDAP path for the Site
dsquery site -name "Site Name"
(original source – link)