Thursday, 15 September 2011

How to export a list of users from an Active Directory group

Every now and then you will come across these little annoying problems while working with Active Directory, which should be easy to solve but requires special tools, for example, that there is no way to export all members of a group in Active Directory Users & Computers . That's when "dsquery" and "dsget" comes into the picture. Here is how to list all members of a particular group.

List all members of the group "MYGROUP":

dsquery group -name MYGROUP | DSGET group -members

You can always send the results to a text file by adding  "> mygroup-members.txt" in the end.