Get distribution group all members – nested

How can we get a list of mailboxes belonging to a distribution group?
In a simple way, by using the EMC console and check who is a member of a group, or by using powershell EMS console and use the command:

Get-DistributionGroupMember Test_Group

 

In this way we get a list of objects in the group, both mailboxes, contacts, and other groups.

And here there is a problem, because if the distribution group includes the next distribution group, and this again next etc, how can we get a list of all people who receive an email after sending a message to a distribution group?

Unfortunately, using only the Get-DistributionGroupMember we won’t get such information.

This command returns only the objects directly in a group, without nesting.

In this case, we have to use PowerShell commands for Active Directory available.

To do this run EMS console and import the Active Directory module command as follows:

import-module ActiveDirectory

Continue reading

Exchange 2010 remove disabled users from distribution group

To keep Exchange Distribution Groups in order, we recommend to “clean” members of those groups.

We should remove all disabled users from distribution groups.

When we have a lot of Distribution Group we can use powershell script like below to do this.

This script gets all Distribution Groups from Exchange Organization, then will check every group for users which are disabled and they have Active Directory account in specified OU.

This script will also export all informations to a .csv file, where you can find following informations:

 

  • Name of distribution group
  • user DisplayName
  • SamAccountName
  • path in Active Directory to user account

Continue reading

Exchange 2010 find empy distribution groups

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