Solved

getting members of groups | active directory | powershell

Posted on 2014-12-20
5
179 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
  • 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 69

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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

810 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