批量爲通信組添加RejectMessagesFromSendersOrMembers成員,此操做不會覆蓋原來的配置,只是增長ide
$groups= Get-DistributionGroup -ResultSize unlimitedspa
foreach($group in $groups) {it
$current= $group.RejectMessagesFromSendersOrMembersio
$current+= 'RejectSendEmailToGroup'class
Set-DistributionGroup$group -RejectMessagesFromSendersOrMembers $current配置
若是想直接覆蓋原來的配置可以使用如下腳本foreach
$RejectGroupOrUser="RejectSendEmail"im
Get-DistributionGroup | foreach{Set-DistributionGroup -Identity $_.name -RejectMessagesFromSendersOrMembers $RejectGroupOrUser}ember