Find distinguished name (LDAP path for the object)

By | June 8, 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 user –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

6 thoughts on “Find distinguished name (LDAP path for the object)

  1. moonshekar

    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”

    Reply
  2. Ganesh

    Hi,

    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.

    Reply
  3. Rajan

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

    Reply
  4. Anonymous

    Command to find the LDAP path for user object

    Dsquery OU –name “User Name”

    the command should be

    Dsquery user –name “User Name”

    exa:

    Dsquery OU –name “John Doe”

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *