List all distributions lists and members via PowerShell

A quick script to run against your Exchange server (on-premises, or O365) to list all distribution groups along with their constituent members:

$Reports=@()
$Groups=Get-DistributionGroup
$Groups| foreach{
$GroupName=$_.Name
$Report=Get-distributionGroupMember -identity $_.identity| select @{Name=”Distribution Group”; Expression={[String]::join(“;”, $GroupName)}}, Name, PrimarySmtpAddress
$Reports=$Reports+$Report
}
$Reports| out-file “c:\temp\Groups.txt”

Save the code as a .ps1 file and then run as normal. Thanks to Evan Liu for the info!

Related Posts

Need IT Help?

If you need assistance please feel free to reach out to us.