Applies to: Exchange Server 2007
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 C:\Get-DGmembers.ps1 and paste below commands into it)
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 C:\Get-DGmembers.ps1 and paste below commands into it)
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
}
Comments
Post a Comment