In this guide, you will learn how to export AD group members to csv. I will show you how to get a list of groups and members with PowerShell and the AD Pro Toolkit.
In this article:
- Option 1. Export Group Members to CSV using the AD Pro Toolkit
- Option 2. Export Group Members to CSV with PowerShell
- Schedule Automatic Group Member Reports
Option 1. Export Group Members to CSV using the AD Pro Toolkit
The AD Pro Toolkit includes multiple AD group member reports that can be export to CSV, Excel or PDF File.
You can Download a Free Trial and try these reports in your own domain.
Step 1. Click on “Group Reports” and select “Group Members Report”.
![export-ad-group-members-1 ad group members report](https://activedirectorypro.com/wp-content/uploads/2024/04/export-ad-group-members-1.webp)
Step 2. Click “Browse” to select a specific group or OU. By default, the tool will get all groups and members.
![export-ad-group-members-2 select ad group or ou](https://activedirectorypro.com/wp-content/uploads/2024/04/export-ad-group-members-2.webp)
Step 3. Click the “Columns” button if you want to add or remove user fields.
Step 4. Click “Run” to generate a list of the group members.
Step 5. Click the “Export” button” to export the list to csv.
![export-ad-group-members-3 export group members to csv](https://activedirectorypro.com/wp-content/uploads/2024/04/export-ad-group-members-3.webp)
You can also get a list of groups a user is a member of by running the “User Groups Report”.
![export-ad-group-members-4 user ad groups report](https://activedirectorypro.com/wp-content/uploads/2024/04/export-ad-group-members-4.webp)
Nested Groups and Members
To get a list of nested groups and members click the “Nested Groups report. This will list all groups that are members of another group. If the parent group has members, you can expand it to see the list.
![nested-group-members nested group and members report](https://activedirectorypro.com/wp-content/uploads/2024/04/nested-group-members.webp)
List only Security Group Members
With the toolkit, you can easily filter on any of the columns. In this example, I’ll filter on the group type to list only security groups and members.
Click on the groupType column and select Security.
![get security groups](https://activedirectorypro.com/wp-content/uploads/2022/12/list-security-group-members-1.webp)
Now the tool will only display security groups and the group members.
![list of security groups](https://activedirectorypro.com/wp-content/uploads/2022/12/list-security-group-members-2.webp)
The toolkit also includes the following group member reports.
- Nested groups
- Nested groups tree view
- Groups with no members
- All security groups
- All distribution groups
- Recently modified groups
- Recently created groups
Option 2. Export Group members to CSV with PowerShell
In this example, I’ll use PowerShell to get a list of users in AD groups and export them to CSV.
Step 1: Load the Active Directory Module
To connect and query an AD group with PowerShell the Active Directory module needs to be loaded.
The Active Directory module can be installed with the following methods:
- RSAT tools installed
- Windows Server 2008 R2 and above with the AD DS or AD LDS server roles
You can run the following command to see if you have installed.
Get-Module -ListAvailable
![powershell module](https://activedirectorypro.com/wp-content/uploads/2017/12/Check-Active-Directory-Module.jpg)
As you can see, I don’t have the module installed.
If you already have the module loaded then jump to step 2, if not then follow these instructions.
To get the Active Directory module installed on my Windows 10 PC, I will need to download and install the RSAT tools.
With the RSAT tools installed, I run the Get-Module -ListAvailable command again
![check powershell ad module](https://activedirectorypro.com/wp-content/uploads/2017/12/Check-Active-Directory-Module2.jpg)
Now I have the module installed, let’s move on to step 2.
RELATED: Tutorial on how to install PowerShell modules
Step 2: Use Get-ADGroup to find the group name
If you already know the name of the group, then skip to step 3.
If you’re not sure what the group name is, you can issue the following PowerShell command to list all Active Directory groups.
Get-ADGroup -filter * | sort name | select name
![get-adgroup powershell command list groups](https://activedirectorypro.com/wp-content/uploads/2017/12/GET-AD.jpg)
Above, is a screenshot of some of the groups listed in my domain. I had an HR group but wasn’t sure of its complete name, I can see it’s HR full. I’ll use that group in step 3 to list out the members.
Step 3: Use Get-AdGroupMember to list group members
The following PowerShell command will list all members of my HR Full group.
Get-ADGroupMember -identity "HR Full"
![get-adgroupmember powershell command](https://activedirectorypro.com/wp-content/uploads/2017/12/GET-AD2.jpg)
You can see the above command provides more details on the group members than I need.
We can filter out the results and just get the member name with this command.
Get-ADGroupMember -identity "HR Full" | select name
![list only group members with powershell](https://activedirectorypro.com/wp-content/uploads/2017/12/GET-AD3.jpg)
Perfect, now I just need to export this to CSV.
Related: How to export all Users from Active Directory
Step 4: Export group members to CSV file with PowerShell
The last step is to export the results to a CSV file.
This is done by adding Export-csv to our above commands. The full command looks like this.
Get-ADGroupMember -identity "HR Full" | select name | Export-csv -path c:\it\filename.csv -Notypeinformation
Now I have a CSV file of all the members from the HR Full Active Directory group.
![get-ad-group-members-export-example csv example of ad group members](https://activedirectorypro.com/wp-content/uploads/2022/12/get-ad-group-members-export-example.webp)
Pretty easy right?
Schedule Automatic Group Member Reports
With the AD Pro Toolkit, you can schedule email reports of group members. This will email you a list of groups and members on a daily, weekly or monthly basis.
- Click on “Scheduler”.
- Click “Add”.
- Select “Reports” and give the task a name.
- Choose a schedule frequency and time.
- Select “Groups -> General” and then select “group members”.
- Select an OU or specific groups.
- For the Ouput options select “Email CSV” or “Save CSV”.
![schedule-group-reports](https://activedirectorypro.com/wp-content/uploads/2024/04/schedule-group-reports.webp)
AD Pro Toolkit (19 Tools in 1) Easy to Use GUI Tools for Active Directory
Download Free Trial
This article is so clear and easy to follow. Thank you.
It works for some groups and for others I see an error “Get-ADGroupMember : Cannot find an object with identity: ‘Pwa xxx’ under: ‘DC=abc,DC=abc,DC=abc’ “.
I see this has been answered in a previous comment but how do I know the name of the server or domain controller for a particular group?
We have multiple domain controllers, how can we get the output for a group in a
different DC
Get-ADGroupMember : Cannot find an object with identity: ‘DC2XXYY-ABCD’ under:
‘DC=dc2,DC=int,DC=us’.
the same command works for groups in dc1
To get group members from a specific domain controller use the -server parameter.
Get-ADGroupMember -server dc2 -identity “HR Full”
Hi,
Is it possible to to retrieve a list of deleted users for a particular group?
Thanks
I want the following command to search the entire directory
Get-ADGroupMember -identity “TEST_GROUP_NAME”
Hi Robert Allen,
can you help please!
I need a info with all local administrators on servers and computers ,but excluded Domain Admins Group
Hi,
See this article:
https://activedirectorypro.com/find-local-administrators-on-all-computers/
Also check out the Local Admin Report Tool
Hai Robert Allen,
How to get user groups names using logon name and password with power shell script and LDAP bind connection.
Can i get the full script which i can run in azure DevOps pipeline and get the details of all AD groups as well as group users.
Thanks Robert! Helped a lot
No problem!
Hi,
You did a great job!
I would like to add few details at Step2 if you don’t see the groups, if the AD has azure information protection.
First you will need to check the name of the group in AD then use the following command in PowerShell:
Get-ADGroupMember -identity “Group_Name” | select name
All the best,
Alex Gheorghisoara
This is very clean and retrieves the information I need for a compliance report. However, I have been asked to transpose data such that the export is formatted such that each group becomes a column header, and the columns contains all members of the “header” group. Any help is greatly appreciated.
Thank you!
Hi Robert,
this is great – any idea how to omit specific emails from results?
Thank you, this info was useful!
Hi
How to export the owners name for a list of service accounts from Powershell ?
Hi
How do I get groups within a nested group please? So I have a parent group, then within that, I have nested groups. I wanted those nested groups (not users)
Thanks
thank you so much. This blog helped me.
Hi ,
I have 120 dl names in one CSV file. How I can get the first member of that all dl using script
Hi Robert, thank you for sharing all these helpful commands and PS-Scripts.
I am trying to create a script that will export all users with their manager name to a csv file. (i got this part done already), I used: get-aduser -Filter * -Properties Manager | Select-Object Name,sAMAccountName,Manager | export-csv C:\temp\UsersManagersExample.csv -notypeinformation.
But also that shows all the membership groups for each user. I am not sure what is the best way to achieve this. Can you help? I am quite sure that there is a way to get this done using powershell.
So I am trying to get a list of all managers and their reporties plus the membership assigned to each user.
Thank you in advance!
Best Regards,
Fady
Thanks ,Its very useful for audit purpose, I have created around 24 .CSV file. How do I can add all in one excel in different tabs in sing excel.
Thanks again
Vaibhav Joshi
Hi Robert, how would I get a listing of all members in an AD group that has members from 2 different domains (universal group). Is this possible? Thanks.
How do we find the AD groups assigned to a Role?
Hi could you point me in the right direction? Any help would be appreciated. At step 3 I’m running into the following error….
Get-AdGroupMember : An unspecified error has occurred
At line:1 char:1
+ Get-AdGroupMember -identity GROUP-TESTA
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: GROUP-TESTA:ADGroup) [Get-ADGroupMember], ADException
+ FullyQualifiedErrorId : ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.GetADGroupMember
Does the group have members from another domain? This command only works if the group members are all from the same domain.
How can I get properties like samaccountname, mail, etc for a group that has members from more than one domain?
I hate to ask this because I should know. How do I get it to export the AD username instead of Last, First?
Hi Robert, bit late to the party here. I am doing something similar but I wanted to be able to export only names that do not match part of a string to the CSV e.g names that do not match “admin*”. I can manipulate the CSV afterwards but would be great if I could do it as part of PS.
Exactly what i am looking for Thank you Robert. I mostly get all the required stuff from activedirectorypro.com
Thanks Kuldip. Glad you found what you needed.
i need an export for names, email addresses, title, location and department…. is that possible?
Yes. I have two tools that make this really easy. You can download a free trial of them both.
1. Active Directory Reporting Tool
2. AD User Export Tool