Exchange 2010: Excluding mailboxes from Dynamic Distro Groups

Dynamic Distribution Groups in Exchange are a wonderful feature.  The management console makes it easy to set them up and add users with the various filters.  But excluding mailboxes can be a bit more tricky.  As an example, we have a group for “All Staff”. It was setup to send to any user with a mailbox under our user’s OU in AD.  However, there are several email boxes there we don’t want to get these emails.  When you run into this some simple tagging will fix your issue.

Step 1.  Set a custom tag on the mailboxes you don’t want to be included.  In my example I wanted to exclude all the conference rooms from this dynamic list.  The rooms were all in their own OU in this example.

Get-Mailbox -OrganizationalUnit "OU=Rooms,OU=Employees,DC=DOMAIN,DC=MY" | Set-Mailbox -CustomAttribute1 "ROOMS"


Step 2.  Set mailboxes with the tag to be excluded from the distro group

Set-DynamicDistributionGroup -Identity "All Staff"  -RecipientFilter { ((RecipientType -eq 'UserMailbox') -and (CustomAttribute1 -ne 'ROOMS')) }

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s