I was trying to complete an audit of a server and needed a quick way to generate a list of users alongwith their appropriate group and stumbled on a command line tool called dsquery.
If you are working with command line tools to manage the active directory then it is very helpful to identify the fully qualified Distinguished Name (DN). Â Using the dsquery command it is very simple to find the DN. The full reference guide to the dsquery command and available options is available at Technet’s Dsquery Guide.
However, as a quick sample, try the following:
1) Open a command prompt
dsquery user -name Leonard*
3) Press Enter
You should see a list of all the users in the directory with the full DN or Active Directory path as listed below: