How to export mail-enabled security group with zero members

Hi team,
Need help on how to export mail-enabled security group members with zero members, the below script script extracts only with members

$mailGroups = Get-DistributionGroup -RecipientTypeDetails MailUniversalSecurityGroup
$Result = @()
$mailGroups | ForEach-Object {
$group = $_
Get-DistributionGroupMember -Identity $group.Identity | ForEach-Object {
$member = $_
$Result += New-Object PSObject -property @{ 
GroupName = $group.DisplayName
Member = $member.DisplayName
PrimarySmtpAddress = $member.PrimarySmtpAddress
}
}
}
$Result | Select GroupName,Member

Thanks
Vel

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.