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 an LDAP path as an input for the commands (like dsget, dsmod), how to find the LDAP path? or LDAP DN

To know more about LDAP and LDAP Query, like the difference between Distinguished Name (DN) and Relative Distinguished Name (RDN) and how we need to use it in an LDAP Query

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 the 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 the 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”

Continue reading → page 1 2

Find distinguished name for bulk user

Extract bulk object from AD with required attributes

General useful windows commands

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 *