O'Reilly logo

Windows Server 2003 in a Nutshell by Mitch Tulloch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

dsquery — new in WS2003

Synopsis

Search for a specific type of object within Active Directory.

Syntax

dsquery command 
                     switches [{-s Server|-d Domain}] [-u UserName] 
[-p {Password|*}] [-desc Description] [-q] [-r] [-gc] [-limit N]

Options

command

Any dsquery command (see below)

switches

Various switches that go with each command (see below)

{-s Server | -d Domain}

Connects to a specified server or domain to run the command (if omitted, defaults to domain controller in logon domain).

[-u UserName] [-p {Password | *}]

Credentials for running the command. Specify UserName as domain\user or user@domain. If -p *, prompts for password.

-desc Description

Description for the object.

-q

Runs in quiet mode to suppress standard output of command.

-r

Performs recursive search or follows referrals during search.

-gc

Performs the search using the global catalog.

-limit N

Number of results to be returned (default is 1000).

Commands

Here is a list of supported dsquery commands together with a brief description of their syntax (only the most commonly used switches are described).

dsquery computer [{StartNode | forestroot | domainroot}] [-o {dn | rdn | samid}] [-scope {subtree | onelevel | base}] [-name Name] [-samid SAMName] [-inactive Weeks] [-stalepwd Days] [-disabled]

Searches for computers within Active Directory. The switches here are:

{StartNode | forestroot | domainroot}

Where to begin the search (default is domainroot)

-o {dn | rdn | samid}

Output search results by distinguished name, relative distinguished name, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required