Last Updated on 2015-07-09.
Using Exchange Management Console (EMC) GUI, you might have experienced that Dynamic Distribution Group feature only offers a few filter conditions. E.g. you cannot use a filter for the “office” AD field or “and/or” combinations, negation etc.
To gain more flexibility, use Exchange Management Shell.
Example
To get all users who work in a certain office OR a certain company, use this shell command:
New-DynamicDistributionGroup 'testgroup' -RecipientContainer mydomain.local/Users -RecipientFilter {office -eq 'myoffice' -or office -eq 'myoffice2'}
After creating the group, you will see it within EMC. You can modify every property in the GUI except your filter string.
Resources
List of available filter properties
http://blogs.interfacett.com/using-powershell-to-manage-dynamic-distribution-groups-and-recipient-filters-in-exchange-server