Preview Dynamic Distribution Group members in Exchange 2013

Using Exchange Powershell, substitute {group} accordingly

$e = get-dynamicdistributiongroup “{group}”
get-recipient -recipientpreviewfilter $e.RecipientFilter


Adding Exclusions to a Dynamic Distribution Group in Office 365 and Exchange

It does not currently seem possible to add exclusions via the Office 365 portal however straight forward to do via powershell. The Office 365 already has a filter in place and this would need modifying.  Examples for Office 365 shown below. To exclude a specific user Steven from a custom Everyone distribution group (

You will need to connect to O365 via PowerShell first (

set-dynamicdistributiongroup -identity Everyone -RecipientFilter {((RecipientType -eq ‘UserMailbox’) -and (-not(Name -like ‘SystemMailbox{*’)) -and (-not(Name -like ‘CAS_{*’)) -and (-not(RecipientTypeDetailsValue -eq ‘MailboxPlan’)) -and (-not(RecipientTypeDetailsValue -eq ‘DiscoveryMailbox’)) -and (-not(RecipientTypeDetailsValue -eq ‘PublicFolderMailbox’)) -and (-not(RecipientTypeDetailsValue -eq ‘ArbitrationMailbox’)) -and (-not(RecipientTypeDetailsValue -eq ‘AuditLogMailbox’)) -and (-not(name -like ‘steven’)))}

To make it easer for administrators to manage via Office 365 portal filter on an attribute that can be easily updated.  Example below filters on the customattribute1 field if set to ‘exclude’

set-dynamicdistributiongroup -identity Everyone -RecipientFilter {((RecipientType -eq ‘UserMailbox’) -and (-not(Name -like ‘SystemMailbox{*’)) -and (-not(Name -like ‘CAS_{*’)) -and (-not(RecipientTypeDetailsValue -eq ‘MailboxPlan’)) -and (-not(RecipientTypeDetailsValue -eq ‘DiscoveryMailbox’)) -and (-not(RecipientTypeDetailsValue -eq ‘PublicFolderMailbox’)) -and (-not(RecipientTypeDetailsValue -eq ‘ArbitrationMailbox’)) -and (-not(RecipientTypeDetailsValue -eq ‘AuditLogMailbox’)) -and (-not(CustomAttribute1 -like ‘exclude’)))}

11/5/16 UPDATE

It now appears that the behaviour has changed of the set-dynamicdistributiongroup has changed therefore only the following is required as the other filters are automatically appended to this

set-DynamicDistributionGroup -Identity everyone -RecipientFilter {(-not(CustomAttribute1 -like ‘exclude’))}

Any further exclusions can then be added using the 365 portal by setting the customattribute1 field to the value exclude.