Solved

Get List of Multiple Active Directory Group Members

Posted on 2013-10-22
7
5,962 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

820 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