Forum Discussion
AllanKelly
Oct 25, 2022Copper Contributor
Excluding users from Dynamic Distribution Group who are not members of M365 Security Group
Hi all, I'm trying to narrow the scope of our existing company-wide dynamic distribution list to only licensed users. I want to accomplish this by requiring members of the dynamic distribution li...
VasilMichev
Oct 25, 2022MVP
"Pure" security groups are not valid Exchange recipients, so you cannot use them in filters and such. A mail-enabled security group would work. Here's how a sample filter can look like:
Get-Recipient -RecipientPreviewFilter {MemberOfGroup -eq "CN=MESG,OU=tenant.onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=EURPR03A001,DC=prod,DC=outlook,DC=com"}
where you need to provide the DistinguishedName value for the group.
Get-Recipient -RecipientPreviewFilter {MemberOfGroup -eq "CN=MESG,OU=tenant.onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=EURPR03A001,DC=prod,DC=outlook,DC=com"}
where you need to provide the DistinguishedName value for the group.