The following PowerShell commands can be used to export the members of an Office 365 Distribution Lists to a .csv file.
Export Members of a Single Distribution List
- Connect to Office 365/Exchange Online using PowerShell. If you have not connected before the link below will walk you through the process
- https://itwalkthroughs.com/knowledge-base/how-to-connect-to-exchange-online-via-powershell/
- Once you have connected run the following command.
- “DL” = the name of the DistrbutionList you would like to export and “FileLocation” is where you would like the .csv saved/exported to
Get-DistributionGroupMember -Identity "DL" -ResultSize Unlimited | Select Name, PrimarySMTPAddress, RecipientType | Export-Csv "FileLocation.csv"
- The following example exports the Distribution List “DL-Support” to a file called DLSupportMembers.csv in the C:\Export\ folder

- The exported .csv will display the data in the following format

Export Members of All Distribution Lists
- The following command can be used to export the members of all Distribution Lists to a .csv file.
- In the command below you will need to change “FileLocation” to the desired location to save the exported file.
$Result=@()
$groups = Get-DistributionGroup -ResultSize Unlimited
$totalmbx = $groups.Count
$i = 1
$groups | ForEach-Object {
Write-Progress -activity "Processing $_.DisplayName" -status "$i out of $totalmbx completed"
$group = $_
Get-DistributionGroupMember -Identity $group.Name -ResultSize Unlimited | ForEach-Object {
$member = $_
$Result += New-Object PSObject -property @{
GroupName = $group.DisplayName
Member = $member.Name
EmailAddress = $member.PrimarySMTPAddress
RecipientType= $member.RecipientType
}}
$i++
}
$Result | Export-CSV "Filelocation.csv" -NoTypeInformation -Encoding UTF8
- The example below exports the list of all DL’s and members to C:\export\All-Distribution-Group-Members.csv

- The exported .csv will display the data in the following format
