Solved

Get List of Multiple Active Directory Group Members

Posted on 2013-10-22
7
5,838 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
Do email signature updates give you a headache?

Constantly trying to correctly format email signatures? Spending all of your time at every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Find out how to use Active Directory data for email signature management in Microsoft Exchange and Office 365.
A brief introduction to what I consider to be the best editor for PowerShell.
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…
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…

910 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

22 Experts available now in Live!

Get 1:1 Help Now