Finds partition objects in the directory that match the search criteria that you specify. If the predefined search criteria in this command are insufficient, then use the more general version of the query command, dsquery *.
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.
For examples of how to use this command, see Examples.
Syntax
dsquery partition [-o {dn | rdn}] [-part <Filter>] [{-s <Server> | -d <Domain>}][-u <UserName>] [-p {<Password> | *}] [-q] [-r] [-gc] [-limit <NumberOfObjects>] [{-uc | -uco | -uci}]
Parameters
Parameter | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
-o {dn | rdn} |
Specifies the format that dsquery uses to display the search results. The following table shows each format. A dn value displays the distinguished name of each entry. An rdn value displays the relative distinguished name of each entry. The default value is dn. |
||||||||
-part <Filter> |
Searches for partitions whose common name (CN) matches the filter that the <Filter> value specifies. |
||||||||
{-s <Server> | -d <Domain>} |
Connects to a remote server or domain that you specify. By default, dsquery connects the computer to a domain controller in the logon domain. |
||||||||
-u <UserName> |
Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:
|
||||||||
-p {<Password> | *} |
Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsquery prompts you for a password. |
||||||||
-q |
Suppresses all output to standard output (quiet mode). |
||||||||
-r |
Specifies that the search use recursion or follow referrals. By default, the search does not follow referrals. |
||||||||
-gc |
Specifies that the search use the Active Directory global catalog. |
||||||||
-limit <NumberOfObjects> |
Specifies the number of objects to return that matches the criteria that you specify. If you specify a value of 0 for <NumberOfObjects>, this parameter returns all matching objects. If you do not specify this parameter, dsquery displays the first 100 results by default. |
||||||||
{-uc | -uco | -uci} |
Specifies that dsquery formats output or input data in Unicode. The following table shows each format.
|
||||||||
/? |
Displays help at the command prompt. |
Remarks
- The results from a dsquery search can be piped as input
to one of the other directory service command-line tools, such as
Dsget, Dsmod, Dsmove, or Dsrm.
- If a value that you use contains spaces, use quotation marks
around the text, for example,
"CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".
- If you use multiple values for a parameter, use spaces to
separate the values, for example, a list of distinguished
names.
- If you specify values for Description, you can use the
wildcard character (*), for example, "NA*", "*BR", and "NA*BA".
Examples
To list the distinguished names of all directory partitions in the current forest, type:
dsquery partition
To list the distinguished names of all directory partitions in the forest whose common name begins with SQL, type:
dsquery -part SQL*