Create a M365 Distribution Group Member Report With PowerShell

Some tasks are better completed using PowerShell, such as creating a report of all Distribution Groups in Microsoft 365 including the group members. Unfortunately, there is no ‘built-in’ method from the Microsoft 365 or Exchange Online Admin Center that allows you to do this. 

In this tutorial, I am going to show you how you can use my script to create a report on all Distribution groups and members using the Exchange Online PowerShell module. The report will look like the below, with a line for each member, with the member type, group display name and group address. If a user appears in more than one group, a new line will represent these membership in each group.


The script in this tutorial uses the Exchange Online PowerShell module. This module contain the necessary commands to connect to Exchange Online and produce the required information.

To install the Exchange Online PowerShell module, I have written a separate tutorial which you can access here: How To Connect to Exchange Online with PowerShell.

The script to create a distribution group and member report

Below is the full script, I recommend you copy and paste this into a text editor first, or PowerShell ISE before running. You will find the result in the C:\temp folder on your drive.

<# Version: 1.0
Author: Daniel Bradley (

#Connect to Exchange Online

#Create report array object
$Report = [System.Collections.Generic.List[Object]]::new()

#Get all groups
$GroupList = Get-DistributionGroup

#Generate report
Foreach ($group in $grouplist) {
    $groupmembers = $null
    $groupmembers = Get-DistributionGroupMember -Identity $group.Name
    Foreach ($member in $groupmembers) {
        $obj = [PSCustomObject][Ordered]@{  
         "Member"                 = $member.PrimarySmtpAddress
         "Member Type"            = $Member.RecipientType
         "Group"                  = $Group.DisplayName
         "Group Address"          = $Group.PrimarySmtpAddress

#Export report
$Report | Export-CSV -path "C:\temp\distribution-group-report.csv" -NoTypeInformation

The results

The report will be produced in CSV format and will be best opened directly in Microsoft Excel. It will look like the following:

Distribution Group Report
Distribution Group Report

Daniel Bradley

My name is Daniel Bradley and I work with Microsoft 365 and Azure as an Engineer and Consultant. I enjoy writing technical content for you and engaging with the community. All opinions are my own.

Leave a Reply