Table of Contents

Dsquery

Homepage: Dsquery at Microsoft

Dsquery is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsquery, you must run the dsquery command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

Search for domain controlers in actual tree/forest

dsquery server

Search in given domain forest

dsquery server -d <domain>

Show complete forest

dsquery server -forest

Show sites

dsquery subnet -limit 0 | dsget subnet | select-string <sitename> 

Example:

dsquery subnet -limit 0 | dsget subnet | select-string SITE2
 
CN=172.16.1.0/24,CN=Subnets,CN=Sites,CN=Configuration,DC=ad,DC=lab,DC=de        Stuttgart            SITE2
CN=172.16.2.0/24,CN=Subnets,CN=Sites,CN=Configuration,DC=ad,DC=lab,DC=de        Huenfeld             SITE2
CN=172.16.3.0/24,CN=Subnets,CN=Sites,CN=Configuration,DC=ad,DC=lab,DC=de        Kerry                SITE2


Authors:
  • Claus Astheimer
  • Jochen Schnuerle