dsquery site

DSQuery Site

Search for a site in active directory.

Syntax DSQuery Site [-o {dn | rdn}] [-name Name] [-desc Description] [{-s Server | -d Domain}] [-u UserName] [-p {Password | *}] [-q] [-r] [-gc] [-limit NumberOfObjects] [{-uc | -uco | -uci}] Key -o The format used to display the search results. dn = distinguished name. rdn = relative distinguished name. samid = Security Accounts Manager (SAM) account name. -name Search for site(s) whose name attribute(CN) matches Name. For example, "br*" -desc Search for site(s) whose description matches. For example, "contractor*" -s Server to connect to (Default=the domain controller in the logon domain.) -d Domain to connect to. -u Username with which the user logs on to a remote server. -p Password (UserName or Domain\UserName or Username@domain.com) -q Quiet, suppress all output -r Recursive search (follow referrals) -gc Use the AD global catalog during the search. -limit The maximum number of objects to return, default=100. -uc Unicode format -uco Unicode format for output only -uci Unicode format for input only

DS* commands are available on networked machines with the server role A.D. Domain Services installed, Domain Controllers (or for XP users: XP Professional).


Find all Sites in the current domain with a name that starts with 'south'

C:\> dsquery site -name south*

“I’d rather wake up in the middle of nowhere than in any city on earth” - Steve McQueen

Related commands:

DSAdd - Add object

DSMod - Modify object

DSGet - Display object

DSMove - Move object

DSQuery - Search for objects

DSRM - Delete object

CSVDE - Import or export AD info in CSV format.

LDIFDE - Edit AD Objects, extend schema, import or export AD information.