Полезное‎ > ‎CMD‎ > ‎

dsquery

DSQUERY

Search for an active directory object.

Syntax
   DSQuery Computer 
   DSQuery Contact 
   DSQuery Group 
   DSQuery OU 
   DSQuery Site 
   DSQuery Server 
   DSQuery User 
   DSQuery Quota 
   DSQuery Partition 
   DSQuery *  (LDAP query)

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

Commas within a CN must be escaped with the backslash \ character CN=Company\, Incorporated...

Escape Backslashes with a second backslash CN=Sales\\ Latin America...

If any value contains spaces, use quotation marks: "CN=John Smith,CN=Users,DC=SS64,DC=com"

Special Tokens
The token $username$ (case insensitive) may be used to place the SAM account name.
Entering * as a password will prompt for a new password.

Adding multiple Objects
For any DS command you can enter multiple values separated by spaces.
e.g. to add several user accounts at once just supply a list of the distinguished names separated with spaces.

It is also possible to store multiple values in a text file and redirect into DSQUERY.

“A good question is like a miniskirt. Long enough to cover the essentials, but short enough to keep everyone interested” - Charles Halsey

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.
Equivalent bash commands (Linux): ldapmodify - Modify Lightweight Directory Access Protocol