Active Directory Command Line

Active directory provides command line to manage it. Dsquery is one of the very powerful command.
It can finds specific object type in the directory.

Dsquery computer: browse computers;
Dsquery contact: browse contacts;
Dsquery user: browse users
Dsquery group: browse groups
Dsquery ou: browse orignazition units
Dsquery server: browse servers
Dsquery site: browse sites
Dsquery quota: browse quota objects
Dsquery partition: browse partitions

Each command supports various options, windows help has all the details.

Dsquery computer
The output is like:
"CN=DC1,OU=Domain Controllers,DC=MS,DC=com"
"CN=DC2,OU=Domain Controllers,DC=MS,DC=com"
"CN=computer1,OU=Old Servers,OU=Server Room,DC=MS,DC=com"
"CN=server1,OU=Server Room,DC=MS,DC=com"
"CN=APTest,OU=Domain Controllers,DC=MS,DC=com"

Search all computers whose name has prefix "AP"
dsquery computer -name ap*
"CN=APTest,OU=Domain Controllers,DC=MS,DC=com"

csvde is an import and export tool. E.g. to export the directory to MyTest.csv:
csvde -f C:\MyTest.csv

This entry was posted in Other Programming. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s