Solved

getting members of groups | active directory | powershell

Posted on 2014-12-20
5
192 Views
Last Modified: 2014-12-20
Hi Experts,

I would like to search for all groups that have a certain text in it.

i would like to export the members of each group to a CSV

in the CSV, i would like to have the name of the group that the user is a member of.  So, my columns would be samaccountname, group
0
Comment
Question by:cmatchett
[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
  • 3
5 Comments
 
LVL 57

Expert Comment

by:Mike Kline
ID: 40510771
What text are you looking for? Is it  in the group name or some other text?

Thanks

Mike
0
 

Author Comment

by:cmatchett
ID: 40510775
Hi Mike,

there are multiple groups that have a similar name and i would like to export all the users of these groups.  In the output, have the group that the user is a member of along with the username
0
 
LVL 70

Accepted Solution

by:
Qlemo earned 500 total points
ID: 40510859
Using the Active Directory module, and shown for domain admins:
get-adgroup -filter "name -like 'dom*admi*'" | % {
  get-adgroupmember $_ | add-member NoteProperty Group $_.name -passThru -force
} | select samAccountName, Group, Name | export-csv -NoType C:\temp\ee\groupmembers.csv

Open in new window

I've added the full name to the output.
0
 

Author Comment

by:cmatchett
ID: 40510884
thank you Qlemo, a job well done
0
 

Author Closing Comment

by:cmatchett
ID: 40510997
excellent
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
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 …
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…

707 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