Set-DistributionGroup -BypassModerationFromSendersOrMembers {add=""} does not work

wisikm 1 Reputation point
2021-08-13T07:48:57.687+00:00

Simple command:

Set-DistributionGroup mitarbeiter-xx -BypassModerationFromSendersOrMembers @{add="mitarbeiter-xx"}

With this command the members of the distribution group are added to the bypass of the moderation of this group. This command delivers no error message BUT it simply deletes every existing bypass entry AND doesn't add itself. If the command is used normally without @{add= then the command works but it replaces instead of adding so it isn't useful for my purpose because I need to add members via batch to several groups.

Via ECP I can do this without any harm.

Same syntax with -moderatedby is also working like expected so I don't seem to have an error in my command.

This should both work like described here: https://learn.microsoft.com/de-de/exchange/recipients-in-exchange-online/moderated-recipients-exo/configure-moderated-recipients-exo

Maybe someone could test it on his side if the same thing happens. We are using Exchange 2016 on premise.

Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,915 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,628 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Vasil Michev 119.2K Reputation points MVP Volunteer Moderator
    2021-08-13T08:46:39.58+00:00

    Seems to work fine here, though I only tested it against Exchange Online.

    0 comments No comments

  2. Andy David - MVP 157.2K Reputation points MVP Volunteer Moderator
    2021-08-13T11:43:22.03+00:00

    Yes, I have seen this in the past on-prem.
    It clears the entire list. - even if I try different ways to add via PS.


  3. KyleXu-MSFT 26,396 Reputation points
    2021-08-16T09:15:05.817+00:00

    @wisikm

    I have tested it with Exchange 2013 CU23, Exchange 2016 CU 14, CU 20, CU 21, Exchange 2019 CU 10, both of them have this phenomenon.

    Thanks for your sharing, I am in further confirmation, if there is relevant information, I will update here.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  4. wisikm 1 Reputation point
    2021-08-17T16:07:44.147+00:00

    Ok, thanks to another guy I could solve it by a workaround:

    Get-DistributionGroup | where {$.alias -like "mitarbeiter-*"} | foreach {
    $bypassModFrom = @((Get-DistributionGroup $
    .alias).BypassModerationFromSendersOrMembers.DistinguishedName)
    $bypassModFrom += (Get-Recipient sekretariat).DistinguishedName
    $bypassModFrom += (Get-Recipient x1).DistinguishedName
    $bypassModFrom += (Get-Recipient x2).DistinguishedName
    $bypassModFrom += (Get-Recipient ******@y.com).DistinguishedName
    Get-DistributionGroup $_.alias | Set-DistributionGroup -BypassModerationFromSendersOrMembers ($bypassModFrom | Select-Object -Unique)
    }


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.