create dynamic distribution group based on an OU, with 2 recipient filters RRS feed

  • Question

  • hello all

    im trying to create a dynamic distribution group based on the following

    -all users with mailboxes of an OU (i.e. contoso.int/US) EXCEPT IF they are part of a distribution group (i.e. US-DontInclude)

    -to make things more complicated, in addition to the above i would like to INCLUDE another distribution group that has users that occasionally travel to the office (i.e. US-DoInclude)

    so in a nutshell the dynamic distribution group will be made up of... 

    1) all users with mailboxes in the OU 'contoso.int/US' EXCEPT if they are part of US-DontInclude distribution group


    2) all users in the US-DoInclude distribution group

    any ideas? i was able to update the dynamic distribution group by using the below, but am unable to also include the members of US-DoInclude

    Set-DynamicDistributionGroup -Identity All.US -RecipientFilter {RecipientContainer -eq 'contoso.int/US' -and (-not(MemberOfGroup -eq 'contoso.int/US/US-DontInclude'))}

    Tuesday, June 9, 2020 9:40 PM

All replies

  • You need to use the full DN of the group in the filter statement.
    Wednesday, June 10, 2020 7:50 AM
  • Hi nyctechguy,

    From the ECP, we can know that dynamic distribution group cannot filter users based on the group:

    The dynamic distribution group is filter user based on "Get-Recipient" command, we can also to know that there doesn't exist "MemberOfGroup" parameter in this command:

    So, we can know that we cannot use "MemberOfGroup" to filter users for dynamic distribution group.

    Here may be workaround for you:

    1. Add a value such as "custom attribute 1" for the group members.

    2. Filter users which the value of "custom attribute 1" not equal to the value that you set in step 1.


    Kyle Xu

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Thursday, June 11, 2020 6:02 AM
  • Hi nyctechguy,

    I am writing here to confirm with you how thing going now?

    If the above suggestion helps, please be free to mark it as an answer for helping more people.


    Kyle Xu

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Monday, June 15, 2020 2:17 AM