prashant1987

Dsquries to find disabled user accounts in Active directory and to find members of security group

Posted on: February 18, 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.

Regards,

-Prashant Girennavar.

Advertisements

4 Responses to "Dsquries to find disabled user accounts in Active directory and to find members of security group"

Hello! Someone in my Myspace group shared this website with us so I came to check it
out. I’m definitely enjoying the information. I’m book-marking and
will be tweeting this to my followers! Exceptional blog and outstanding design and style.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

%d bloggers like this: