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 Settings\mikeb>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 Settings\mikeb>dsquery user -samid mikeb | dsget user -email

The result of this command is MBailey@contoso.com.

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