Dsquery quota

Applies To: Windows Server 2008, Windows Server 2008 R2

Finds quota specifications in the directory that match the search criteria that you specify. A quota specification determines the maximum number of directory objects that a security principal can own in a directory partition that you specify. If the predefined search criteria in this command are insufficient, 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.


dsquery quota {domainroot | <ObjectDN>} [-o {dn | rdn}] [-acct <Name>] [-qlimit <Filter>] [-desc <Description>] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [-r] [-gc] [-limit <NumberOfObjects>] [{-uc | -uco | -uci}]


Parameter Description

{domainroot | <ObjectDN>}

Required. Specifies where the search begins. Use <ObjectDN> to specify the distinguished name (also known as DN) or use domainroot to specify the root of the current domain.

-o {dn | rdn}

Specifies the format that dsquery uses to display the search results. The following list explains each format.

  • dn: Displays the distinguished name of each entry. This is the default value.

  • rdn: Displays the relative distinguished name of each entry.

-acct <Name>

Specifies to find the quota specifications that are assigned to the security principal (user, group, computer, or InetOrgPerson) that <Name> represents. You can use the distinguished name of the security principal or the Domain\SAMAccountName of the security principal to specify the -acct parameter.

-qlimit <Filter>

Specifies to find quota specifications whose limit matches <Filter>.

-desc <Description>

Searches for quota objects that have description attributes that match <Description>, for example, "jon*", "*ith", or "j*th".

{-s <Server | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, the computer is connected 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:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-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.


Suppresses all output to standard output (quiet mode).


Specifies that the search use recursion or follow referrals. By default, the search does not follow referrals.


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 list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.


Displays help at the command prompt.


  • 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", or "NA*BA".

  • Any value for <Filter> that you specify with qlimit is read as a string. You must enclose this parameter in quotation marks. In addition, you must enclose any value ranges that you specify using <=, =, or >= in quotation marks, for example, -qlimit "=100", -qlimit "<=99", -qlimit">=101". To find quotas with no limits, use "-1".


To list the accounts in the current domain that have quota specifications assigned to them, type:

dsquery quota domainroot

To list users named Jon in the SALES domain partition, type:

dsquery user -name jon* | dsquery quota domainroot -acct

Additional references

Command-Line Syntax Key


Dsquery computer

Dsquery contact

Dsquery group

Dsquery ou

Dsquery site

Dsquery server

Dsquery user

Dsquery partition

Dsquery *