Dsquery and dsget are a couple command line tools you can utilize to quickly search for specific objects in your domain.
Dsquery as the name implies queries the directory by using search criteria that you specify in the command.
Dsget is used to display the properties of a specific object and it can be useful to pipe the output of dsquery into dsget.
Here are some common ways you might use the commands:
Dsquery user –name “John Doe”
Dsquery user –name “John Doe” | dsget –email
Dsquery user –name “John Doe” | dsget user –disabled
Dsquery user –name “John Doe” | dsget user –memberof
Dsquery computer –name computer01
Dsquery computer “OU=laptops,OU=computers,OU=Edmonton, DC=contoso,DC=com”
Dsget computer “CN=user1-1234,OU=laptops,OU=computers, OU=Edmonton,DC=contoso,DC=com” -memberof
Dsquery computer -name user1-1234 | dsget computer -memberof
Dsquery computer –name computer01 | dsget computer –samid
Dsquery computer –name computer01 | dsget computer –sid