Solved

Get List of Multiple Active Directory Group Members

Posted on 2013-10-22
7
5,896 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A brief introduction to what I consider to be the best editor for PowerShell.
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
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…

777 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