DSQUERY is another simple command line utility for searching Active Directory. If it’s in AD, this tool can find it.
List the DN of all computer accounts:
dsquery computer
List all computers that have been inactive for the last 6 weeks:
dsquery computer -inactive 6
List all domain controllers:
dsquery server
List all computers within a specific OU:
dsquery computer ou=servers,dc=bigdog,dc=com
Refer to the DSQUERY Command Line Reference on Microsoft TechNet.
Advertisement