Generally, you can simply get the Distribution Groups or it members by using the following Exchange Cmdlet.
- If we need to get all existing distribution groups, run the
Get-DistributionGroup cmdlet.
- If we want to find all distribution group members, use the
Get-DistributionGroupMember cmdlet.
However, some administrator inquires if we can list all the distribution groups and their members in a single result. Based on our tests, we can use the following
scripts to list all existing distribution groups and their members.
foreach ($group in Get-DistributionGroup) { get-distributiongroupmember $group | select Name,@{n='DistributionGroupName';e={$group.Name}} }
If there are too many distribution groups and members, you can export the result to a csv file using the scripts below.
$groupmembers = foreach ($group in Get-DistributionGroup) { get-distributiongroupmember $group | select Name,@{n='DistributionGroupName';e={$group.Name}}
}
$groupmembers | Export-Csv C:\DGgroupmembers.csv NoTypeInformation
Then you can find the result in the DGgroupmembers.csv file.
Reference:
Exchange 2007 - enumerate distribution lists members
Note:
Based on my tests, the above scripts apply to Exchange Server 2007, Exchange Server 2010 and Exchange Server 2013.