Solved

Get List of Multiple Active Directory Group Members

Posted on 2013-10-22
7
6,192 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Resolving an irritating Remote Desktop connection that stops your saved credentials from being used.
This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Suggested Courses

623 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