This script below will be useful to you:
$DDGS = Get-DynamicDistributionGroup
foreach($DDG in $DDGS){
$temp = $DDG.Name
$value = (Get-Recipient -RecipientPreviewFilter (Get-DynamicDistributionGroup $temp).RecipientFilter -resultsize unlimited | Measure-Object).count
Write-Host $temp" has "$value" Group Members"
}
Save this script into a .PS1 file, then run it in PowerShell:
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.