Friday, 19 February 2010

Helpful AD Commands

Dsquery is a command-line tool that is built into Windows Server. To use dsquery, you must run the dsquery command from an elevated command prompt.

use dsquery to get back only the active users
dsquery user -limit 0

Command line Active Directory query tool. Primarily used to find and cleanup old computer accounts that haven't been used. Can also be used to clean up user accounts when the proper filter is specified. 

oldcmp -report
Generate html report of all cmpaccs > 90 days old

oldcmp -report -age 0 -onlydisabled
Generate html report of all disabled cmpaccs

oldcmp -disable -unsafe -forreal
Generate html report of all cmpaccs > 90 days, sort on pwage
Will REALLY DISABLE all accounts identified.

csvde examples of import and export user accounts to and from Active Directory.

Get a list of members contained within a group
csvde.exe -f output.csv -r (objectClass=group) -l member

Get list of computer objects
csvde.exe -f output.csv -r (objectClass=Computer)

No comments:

Post a Comment