Oddness when creating a dynamic distribution list in Exchange 2007 with custom filters

I recently ran into an interesting bug in Exchange 2007. I was creating a dynamic distribution list in the Exchange Management Shell. I set up a custom filter so that if a user’s AD account description had the word “common” in it, that user would be excluded from the distribution list.

Here’s the code for the DL:

New-DynamicDistributionGroup "EveryoneBlah" -OrganizationalUnit "blah.com/DL" -RecipientContainer "blah.com/blah/Lewiston/blah" -IncludedRecipients MailboxUsers

Here’s the code for the filter:

Set-DynamicDistributionGroup EveryoneBlah -RecipientFilter {(((RecipientType -eq 'UserMailbox') -and -not (description -like 'common'))) }

When I tried to test the filter by viewing the filtered list of recipients using the Exchange Management Console or by using the Exchange Management Shell, I would be shown a list of the users that the filter had been applied to BUT that list would not be limited by the RecipientContainer that had been specified.

So I did some searching and asking around and was pointed to this guy’s blog. He found out that this is actually a bug in Exchange 2007! The dynamic distribution group and the filter work just fine. It’s Exchange 2007’s functionality to SHOW the correct list of users that the DL is applied to that’s wonky.

Further Reading: