Script to Determine Members of a Group

Filed Under (Active Directory, Scripting) by on 12-10-2007

Back in February I needed a script to display the groups a user belonged too. Today I was asked about the opposite. I needed to find a way to list the members of a group. Thankfully I blogged about the first issue in February because that led me to the solution. I”m actually using the same DSGET command but instead of using the user command I”m using the group command.

DSGET GROUP CN=West_Coast_Sales,OU=Sales,OU=GROUPS,DC=adminprep,DC=com -MEMBERS –EXPAND

“CN=bmiller,OU=Sales,DC=adminprep,DC=com “
“CN=jsmith,OU=Sales,DC=adminprep,DC=com “
“CN=dregan,OU=Sales,DC=adminprep,DC=com “
“CN=lramero,OU=Sales,DC=adminprep,DC=com “
“CN=cpeters,OU=Sales,DC=adminprep,DC=com “
“CN=jhorton,OU=Sales,DC=adminprep,DC=com ”

Hopefully this solution works for you too.

Leave a Reply