Dsquery

Use Dsquery to query for ADsPaths.

Readers

January 23, 2007

1 Min Read
ITPro Today logo in a gray background | ITPro Today

The Reader to Reader article "Get ADsPaths with the Click of a Button" (August 2006, InstantDoc ID 50581) presented the GetADsPath.hta utility, which returns the ADsPath strings of Active Directory (AD) objects. An alternative solution is to use Dsquery at the command prompt. For example, if I want to get my ADsPath, I simply type:

C:Documents and Settingsmikeb>dsquery user -samid mikeb

Dsquery returns the ADsPath CN=mikeb,OU=Users,DC=contoso,DC=com.

To get an email address associated with an ADsPath, you can use Dsquery with Dsget. For example, to get my email address, I'd type:

C:Documents and Settingsmikeb>dsquery user -samid mikeb | dsget user -email

The result of this command is [email protected].

I often use Dsquery and Dsget to find servers and clients whose exact names I don’t know. The Windows Server 2003 Administration Tools Pack (adminpak.msi) contains dsquery.exe, dsget.exe, and other handy Directory Service (DS) tools.

—Michael Bailey

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like