Display or Export the Members of Exchange Distribution Groups
The members of Distribution Groups can be viewed and modified through the Outlook Address Book. However, Outlook doesn’t offer a way to export a list of all the members.
Administrators can run the following Exchange Management Shell commands to display/export the memberlist, sorted by DisplayName.
Single Distribution Group
- Display Memberlist
Get-DistributionGroupMember {Name of Group} | Sort -Property DisplayName | Select DisplayName, Alias, Department
- Export Memberlist to TXT file
Get-DistributionGroupMember {Name of Group} | Sort -Property DisplayName | Select DisplayName, Alias, Department > C:DGmemberlist.txt
- Export Memberlist to CSV file
Get-DistributionGroupMember {Name of Group} | Sort -Property DisplayName | Select DisplayName, Alias, Department | Export-CSV C:DGmemberlist.csv
All Distribution Groups in the Exchange Organization
- Display Memberlist (create a script file called something like C:scriptsGet-DGmembers.ps1, paste below commands into it, and run the file in the Exchange Management Shell)
get-distributiongroup | Sort -Property DisplayName | foreach {
$name = $_.displayname
$output = ‘Group Name: ‘ + $Name
write-output $output
Get-DistributionGroupMember $name | Sort -Property DisplayName | Select DisplayName, Alias, Department
write-output “” “”
}
- Export Memberlist to TXT file (create a script file called something like C:scriptsExport-DGmembers.ps1, paste below commands into it, and run the file in the Exchange Management Shell)
write-output “” > C:outputDGmembers.txt
get-distributiongroup | Sort -Property DisplayName | foreach {
$name = $_.displayname
$output = ‘Group Name: ‘ + $Name
write-output $output >> C:outputDGmembers.txt
Get-DistributionGroupMember $name | Sort -Property DisplayName | Select DisplayName, Alias, Department >> C:outputDGmembers.txt
write-output “” “” >> C:outputDGmembers.txt
}
Yorumlar