Create Dynamic Distribution List based on email domain

Create Dynamic Distribution List based on email domain

I spent a while looking around for a solution for this issue – at first, I wasn’t able to create a recipient filter that worked on a user’s domain.

I eventually found a solution that worked by filtering on the WindowsLiveID property, which is pretty much always the same as the primary smtp address and user principal name.

You’ll first need to connect to Exchange Online via Powershell.

The following line will create a dynamic distribution group filtered by the users’ domain:

New-DynamicDistributionGroup -name "All Users - Domain Name" -RecipientFilter "(RecipientTypeDetails -eq 'UserMailbox') -and (WindowsLiveID -eq '*@domain.com')

These lines will confirm that the correct users were added to the new dynamic distribution group:

$group = Get-DynamicDistributionGroup "All Users - Domain Name"
Get-Recipient -RecipientPreviewFilter $group.RecipientFilter

When running this, be sure to update the @domain.com and All Users – Domain Name values to your appropriate values.

Was this article helpful?

Related Articles

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

Need Support?

Can't find the answer you're looking for?
Contact Support