How to update a Dynamic Distribution Group Recipient Filter

During an Office 365 / Exchange Online migration, you may have a requirement to update the recipient filter of any dynamic distribution group.

In my case, I needed to do this because the dynamic distribution group used filters to include only mailboxes. But mailboxes that are migrated to Office 365 become mail-enabled users in the on-premises directory. This can cause issues with certain members of a dynamic distribution group not receiving email messages. The issue is described here

The process is quite simple… using the Set-DynamicDistributionGroup to update the recipient filter to include the MailUser and MailContact.  What can be tricky however is getting the syntax correct.

The following is an example of the process and syntax I used to update a Dynamic Distribution Group to include mail enabled users:

  1. First, I got the original recipient filter details but running the following command

Get-DynamicDistributionGroup -Identity DDGName  |fl RecipientFilter

  1. I then took a copy of the original recipient filter which was as follows:

“((((RecipientType -eq ‘UserMailbox’) -and (((MemberOfGroup -eq ‘CN=grpUsers1,OU=Domain Groups,DC=domain,DC=ie’) -or (MemberOfGroup -eq ‘CN=grpUsers2,OU=Domain Groups,DC=domain,DC=ie’))))) -and (-not(Name -like ‘SystemMailbox{*’)) -and (-not(Name -like ‘CAS_{*’)))”

  1. I then added the MailUser and MailContact recipient type (highlighted in bold) to the recipient filter and used the Set-DynamicDistributionGroup with the following syntax to update the recipient filter:

Set-DynamicDistributionGroup -identity “DDGName” -RecipientFilter “((((RecipientType -eq ‘UserMailbox’) -or (RecipientType -eq ‘MailUser’) -or (RecipientType -eq ‘MailContact’) -and (((MemberOfGroup -eq ‘CN=grpUsers1,OU=Domain Groups,DC=domain,DC=ie’) -or (MemberOfGroup -eq ‘CN=grpUsers2,OU=Domain Groups,DC=domain,DC=ie’))))) -and (-not(Name -like ‘SystemMailbox{*’)) -and (-not(Name -like ‘CAS_{*’)))”

 

 

Leave a Reply

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