适用于Exchange 2010/2013/2016

1)导入AD和exchange的管理模块

## Add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010
Add-pssnapin *exchange*
Import-Module activedirectory

2)删除通讯组成员

$userdata=Import-Csv D:\scripts\userdata.csv -Encoding Default

foreach ($ud in $userdata)
{
Remove-DistributionGroupMember -Identity $ud.GroupName -Member $ud.UserName -BypassSecurityGroupManagerCheck -Confirm:$false

}

3)添加通讯组成员

##Add-DistributionGroupMember -Identity 'it.tsg' -Member '[email protected]' -BypassSecurityGroupManagerCheck -Confirm:$false

扫描添加如下的微信公众号,获取更多的IT资讯:
Powershell添加或删除通讯组成员_第1张图片