Solved

Get List of Multiple Active Directory Group Members

Posted on 2013-10-22
7
5,787 Views
Last Modified: 2014-09-18
I have about 30 security groups that I need to get the members of into a csv/xls. I can run a dsquery or netgroup, but that's only per specific group.  Is there a way to get it for a list of groups either through command line, or through ADUC filtering?  All the group names contain the words "VPN User", so is there some type of wildcard search i can use, such as VPN User* or similar to get the membership of all groups?
0
Comment
Question by:fireguy1125
7 Comments
 
LVL 35

Expert Comment

by:Joseph Daly
ID: 39591199
You can do this with the quest powershell cmdlets. The powershell below should work.

get-qadgroup *VPN users* | foreach{
$name=$_.name
$members = get-qadgroupmember $name
"$members">>C:\$name.txt}

This will create a text file for each group with the names of the users in it.
0
 
LVL 22

Expert Comment

by:Joseph Moody
ID: 39591219
Here is a powershell script that uses the quest ad cmdlets.

$Groups =Get-QADGroup *VPN Users*

foreach ($Group in $Groups) {

$Group | Out-file .\Groups.txt -Append
Get-QADGroupMember $Group | out-file .\Groups.txt -Append

}

Here are the cmdlets: http://www.quest.com/powershell/activeroles-server.aspx
0
 
LVL 1

Author Comment

by:fireguy1125
ID: 39591221
Any way of getting the results into one txt file?
0
 
LVL 22

Expert Comment

by:Joseph Moody
ID: 39591224
@xxdcmast: I guess I should have refreshed first.... :)
0
 
LVL 10

Expert Comment

by:ienaxxx
ID: 39591227
i answered a question like this here


import-module ActiveDirectory
Get-ADGroupMember Group-Name | select name,SID | Export-Csv c:\myCSV.csv

Open in new window

in powershell

csvde -r "(&(objectClass=User)(memberof=CN=myDesiredGroup,OU=myGroupsOU,OU=myOU,DC=myDOMAIN,DC=local))" -f myCSV.csv

Open in new window

csvde

dsquery group -name myGroupName | dsget group -members

Open in new window

dsquery


but the first powershell and the last dsget can be recursive, if you want, with -recurse and -expand respectively.
0
 
LVL 22

Accepted Solution

by:
Joseph Moody earned 500 total points
ID: 39591232
The script I posted will put the results into one file. :)
0
 

Expert Comment

by:AVC AVC
ID: 40331707
Can I get a list of all the members from a list of security groups in an OU.
0

Join & Write a Comment

Set OWA language and time zone in Exchange for individuals, all users or per database.
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now