none
Setting Exceptions in Dynamic Distribution Group RRS feed

  • Question

  • Can someone tell me what is wrong with my syntax?

    Set-DynamicDistributionGroup -Identity Everyone -RecipientFilter (((-not(CustomAttribute13 -eq 'NoEmail') -and (RecipientType -eq 'UserMailbox'))) -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')))

    I get this when I run it:

    The term 'CustomAttribute13' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:91
    + Set-DynamicDistributionGroup -Identity Everyone -RecipientFilter (((-not(CustomAttribute13 <<<<  -eq 'NoEmail') -and (RecipientType -eq 'UserMailbox'))) -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')))
        + CategoryInfo          : ObjectNotFound: (CustomAttribute13:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException

    I am trying to set my filter to exclude CustomAttribute13 = "NoEmail" and include All users with Exchange mailboxes.

    THanks


    Thursday, September 28, 2017 9:19 PM

Answers

  • Hi,

    Please try the following command:

    Set-DynamicDistributionGroup -Identity Everyone -RecipientFilter {(((-not(CustomAttribute13 -eq 'NoEmail')) -and (RecipientType -eq 'UserMailbox'))) -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*'))}


    I test in my environment and it works fine. Below is the test result.

    Note: Don’t forget the "{}" around the RecipientFilter value.


    Best Regards,

    Manu Meng
    TechNet Community Support


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    • Marked as answer by TFHD Friday, September 29, 2017 1:58 PM
    Friday, September 29, 2017 10:05 AM
    Moderator