Set exchange policy with filter?

Brass Contributor

I am trying to figure out how to run a command to create a exchange online emailadresspolicy.


New-EmailAddressPolicy -Name Groups1 -IncludeUnifiedGroupRecipients -EnabledEmailAddressTemplates "","" -RecipientFilter {mailNickname -like 'Santa_*'} -Priority 1



I want all groups that are that have a mailnickname that starts with "Santa_" to be created with a specific subdomain.

I can not create it tho, i get error that recipientFilter is not a valid attribute.

New-EmailAddressPolicy: A parameter cannot be found that matches parameter name 'RecipientFilter'.


i have also tried ConditionalCustomAttribute1  but get the same error:



anyone able to help?



3 Replies
Use the New-EmailAddressPolicy cmdlet to create email address policies. In Exchange Online, email address policies are available only for Microsoft 365 Groups.
I dont understand. Do you mean that it is not possible to use filtering in exchange online?

So there is no way to trigger the policy based on a groups mailNickname value then?
It's not possible in Exchange Online. But, when in Hybrid, you can use the OnPrem Exchange server. Alternatively, you can use scripts like this one