SOLVED

Exclude a single E-mail from Dynamic distribution Group

Copper Contributor

I'm trying to find the exact command to use in PowerShell to remove a user from a dynamic distribution l.  Can someone point me in the right direction? Thanks in advance.

8 Replies
There isn’t an exclude filter. You can move that person to a different OU and not include that in the OU filter or get fancy with the recipient filter by making use of custom fields or fields that everyone is in but not that person. So if the group is created off city or department you could remove their department or add a space or something to it so it doesn’t match and pick up. But depending if you have some other questions using these fields might not be an option.
best response confirmed by Chris Webb (MVP)
Solution

Or, simply use the *not* clause in your existing recipient filter, no need to add any complexity. Here's an example:

 

((UsageLocation -eq 'Bulgaria') -and (Name -ne 'vasil'))

or

-not(RecipientTypeDetails -eq 'SharedMailbox')

Duh.... didn’t think you could reference name field but been a long time since messing with dynamic groups. Would make sense that you should be able to use any ad field.

This doesn't work but thank you for your suggestion

Works just fine for me, in fact almost all of the DDGs I have include the not clause in some form in their recipient filter. If you share the filter you tried to use, we might be able to give you a pointer.

@Shoga Hailemariam 

@Chris Webb 

 

Dear Sir,

I would need to exclude the shared mailboxes to avoid my users to get the same e-mail multiple times.

they have one thing in common : there are all "Unlicensed" users  so I thought maybe there could be a rule to be added for this exception ?

Thanks for your help

 

Vasil showed in his response how to do it using not and shared Mailbox. See example here:

((UsageLocation -eq 'Bulgaria') -and (Name -ne 'vasil'))
or
-not(RecipientTypeDetails -eq 'SharedMailbox')
1 best response

Accepted Solutions
best response confirmed by Chris Webb (MVP)
Solution

Or, simply use the *not* clause in your existing recipient filter, no need to add any complexity. Here's an example:

 

((UsageLocation -eq 'Bulgaria') -and (Name -ne 'vasil'))

or

-not(RecipientTypeDetails -eq 'SharedMailbox')

View solution in original post