There may be an occasion when we need to find out who the members of a dynamic distribution group are.
The following two commands should get us what we need, when run from the Exchange Management Shell. The only changes that need to be made to the commands are the items in red; based on the dynamic distribution group name and the location we want to create the CSV file.
$DDGMembers = Get-DynamicDistributionGroup "DDGNAME" Get-Recipient -RecipientPreviewFilter $DDGMembers.RecipientFilter | Select Name,PrimarySmtpAddress,RecipientType | Export-Csv "C:\DDGMembers.csv" -NoTypeInformation
If there is nothing in the CSV file or in the $DDGMembers variable, it’s most likely because a) the dynamic distribution group doesn’t exist (or the name was mistyped); b) we are not running the command in the Exchange Management Shell; or c) we do not have the proper permissions to run the commands.