This post is also available in: Polish
When you have big Microsoft Exchange environment, you probably have many Distribution Groups.
Often you create distribution groups when you need them or someone need, and after that you forget about them.
It’s good to clean unused grups from time to time.
Below we present powershell command to find distribution groups without members.
If you have any distribution group without members, you will receive informations about name, smtp address and Managed By.
You can simply use below commands:
$DistrGroups = Get-DistributionGroup -ResultSize Unlimited ForEach ($DistrGroup in $DistrGroups) { if (!$(Get-DistributionGroupMember -Identity $DistrGroup.’DistinguishedName’)) { Write-Host $DistrGroup.DisplayName "," $DistrGroup.PrimarySmtpAddress "," $DistrGroup.ManagedBy } }