Empty Distribution Groups


I was just wondering if someone could help me opn this. I am trying to run a script to find a list of all empty distribution groups using powershell.

When I do:

Get-ADGroup -Filter (‘groupcategory -eq “distribution”’) -Properties *

This lists all distribution groups. However, I need to filter further to select where members = null/empty.


This will get all your distribution groups with a member count of 0:

$Groups = Get-ADGroup -Filter "groupcategory -eq 'Distribution'" -Properties Members |
Where-Object {$_.Members.Count -eq 0}

Thanks Matt for your help - works!