Exchange 2010 find empy distribution groups

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
  }
}

 

 

Print Friendly
Tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>