Archive for February 2012

Hello All,

This week I was assigned a task to clean up my Active directory(Disabled user accounts).I was knowing that dsquery and dsget
command lines will help me out (Though I was not aware of exact commandlines). Upon searching and putting this question on TechNet
Forum finally I got the commandline to accomplish the task.

dsquery user -disabled -limit 0

This command will list all the disabled user accounts in an AD enviornment. ( -limit 0 is used to list more than 100 disabled user accounts)

dsquery user -disabled -limit 0 | dsget user -fn -ln > disabled account.csv

Above command will give output in .csv format and the disabled users first and last name will be generated in the output file.

Apart from this we can list the members of perticular security group with following commandline

dsquery group -name “GroupName” | dsget group -members | dsget user -fn -ln > members.csv

for Member Of Information,

dsquery group -name “GroupName” | dsget group -memberof | dsget user -fn -ln > Memberof.csv

Hope this Helps.


-Prashant Girennavar.