Excluding Resource Mailboxes (e.g. rooms) from Dynamic Distribution Groups in Office365

I hadn’t noticed until today that rooms are included in Office365 dynamic groups even if you selected “Users with Exchange mailboxes”. This creates an interesting effect if you send an appointment to that group, you will automatically book all your meetings rooms as well. Not necessarily what you want.

group

The solution is fairly straight forward. Via Powershell you add a specific filter for MailboxType as follows. Warning: you can’t edit the members filter from the EAC anymore after that.

#
# Connect to Office365
#
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
#
# Add the filter
#
Set-DynamicDistributionGroup -Identity "yourgroup@example.org" -RecipientFilter {(RecipientTypeDetails -eq 'UserMailbox')}
#
# Test the filter works by enumerating the members
#
$FTE = Get-DynamicDistributionGroup "yourgroup@example.org"
Get-Recipient -RecipientPreviewFilter $FTE.RecipientFilter
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s