Empty Distribution Groups

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Minesh Patel Minesh Patel 1 year, 11 months ago.

  • Author
    Posts
  • #21717
    Profile photo of Minesh Patel
    Minesh Patel
    Participant

    Hi,

    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.

    Thanks,
    Minesh

  • #21719
    Profile photo of Matt McNabb
    Matt McNabb
    Participant

    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}
  • #21727
    Profile photo of Minesh Patel
    Minesh Patel
    Participant

    Thanks Matt for your help – works!

You must be logged in to reply to this topic.