Seems to work fine here, though I only tested it against Exchange Online.
Set-DistributionGroup -BypassModerationFromSendersOrMembers {add=""} does not work
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
Windows Server PowerShell
4 answers
Sort by: Most helpful
-
Vasil Michev 119.2K Reputation points MVP Volunteer Moderator
2021-08-13T08:46:39.58+00:00 -
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. -
KyleXu-MSFT 26,396 Reputation points
2021-08-16T09:15:05.817+00:00 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. -
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)
}