运行环境:Exchange 2013/2016

添加之前先对现有的配置进行导出备份

$FormatEnumerationLimit = -1
Get-ExchangeServer -Identity ex1601 | Get-ReceiveConnector | select server,remoteiprang
es,identity | ft -Wrap

然后获取要添加IP地址的连接器信息,把信息保存到$re变量

$re = Get-ReceiveConnector -Identity "ex1601\Annoymous ex1601"

把要添加的IP放到txt中,追加到$re.RemoteIPRanges中

Get-Content "C:\Users\exadmin\Desktop\IP.txt" | foreach {$re.RemoteIPRanges += "$_"}

使用set-receiveconnector进行设置

Set-ReceiveConnector "ex601\Annoymous ex1601" -RemoteIPRanges $re.RemoteIPRanges

欢迎扫描关注本人的微信公众号,获取更多IT资讯:
Powershell为接收连接器批量添加RemoteIP地址_第1张图片