Find distinguished name (LDAP path for the object)

9 June 2009

If you are working with command line tools to manage the active directory then you will require a LDAP path as an input for the commands (like dsget, dsmod), how to find the ldap path? or ldap dn

There is a simple way to find the ldap dn using the Dsquery command

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 OU –name "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"

You can also use the Search AD Object using the Attribute value tool to find the LDAP path, using this tool yoo can do customized search on Active Directory.

Subscribe to Windowstricks by E-mail to get the free updates and free tools

Related Articles

how to find the ldap path

List active directory group members

find distinguished name

Search object using Attribute in Active Directory

Share this . . .


moonshekar 22 September 2011 05:19  

Hi ,

You are doing a wonderful job and thank you very much for your selfless service
I think the command for getting distinguishe name should be corrected as dsquery user -samid "username"

Ganesh 23 September 2011 11:40  


Thanks for your comments, it’s depends on the input, if you have the CN value, you can use the –name, if you have the samid then you can use the –samid.

Eddi,  24 February 2012 20:46  


You are amazing!!

Rajan,  21 October 2012 16:23  

thanks for the useful commands. Please give an example for each of them to understand better rather than abstract names.

Post a Comment


About Me

My Photo

I am Ganesh. Active Directory, Exchange, Windows Server and Migration Specialist, and author of

Copyright   © 2014 - - all rights reserved | Powered by Blogger | Blogger template The Beach by

Back to TOP