Thursday, March 22, 2007

How To: List the Members of a Group

How many times have you been asked – “Who is a member of this group?” or “Can I have a list of members of this group?”

Well, I have.. a lot! Generally, it is a security group, where only an Admin can see the members or a person has a list of groups. So, here is an easy way to get that information.

for /f "tokens=* usebackq" %i in (`adfind -default -list -f "name=domain admins" member`) do @adfind -b "%i" -s base -list mail

The output will look like

Sam@somewhere.com
Bob@somewhere.com
John@somewhere.com

Then you can just pipe it to a text file (>>admins.txt).. then ship that off to whoever wants it. You can find the adfind tool from Joe Ware (http://www.joeware.net/freetools/index.htm).

No comments: