O365 Dynamic distribution group filters

lee roberts 186 Reputation points
2021-07-22T15:52:00.447+00:00

I'm trying to create a dynamic distribution list in exchange online based on the email domain. The below is what i have but it returns all user not just the users i want

Set-DynamicDistributionGroup -Identity "Users" -RecipientFilter "(RecipientType -eq 'UserMailBox') -and (EmailAddresses -like 'SMTP:*domain.com')" -PrimarySmtpAddress "******@domain.com" 

We have multiple domains in our tenant

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 47,901 Reputation points
    2021-07-22T18:39:22.467+00:00

    Shouldn't that filter look like this?

    EmailAddresses -like 'SMTP:*@keyman .com'

    Is it possible that all your domains are similar and they all end in "domain.com"? E.g. sub1.domain.com, sub2.domain.com, and domain.com. Or ABCdomain.com, DEFdomain.com, and domain.com,

    This more of an Exchange question than a PowerShell question.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.