[code]
#Location where csv and script is located on the server.
$Path = '%Path%'
$file = read-host "Enter the name of the csv file"
#Hubtransportservers and the servers receiver connectors
$Node1 = '%Servername%\%ReceiveConnectors%'
$Node2 = '%Servername%\%ReceiveConnectors%'
#If you want to use a text file, you have to replace the csv by txt below.
$RCC = Get-receiveConnector $Node1
Import-csv "$Path\$file.csv" ForEach {$RCC.RemoteIpRanges += $_.IpAddresses}
$RCC Set-ReceiveConnector
$RCC = Get-receiveConnector $Node2
Import-csv "$Path\$file.csv" ForEach {$RCC.RemoteIpRanges += $_.IpAddresses}
$RCC Set-ReceiveConnector
Write-Host "IP Addresses have been added to receive connectors $Node1 and $Node2"
[/Code]
This script uses a CSV file, but you can alter it to a TXT file if you please.
You need to adjust following variables to make this script suitable for you:
- $Path = fill in the path where the csv or txt file can be located
- $NodeX = Fil in the paths of the recieve connectors on the multiple servers. This scripts references one receive connector on two different servers. You have have more servers/receive Connectors you need to define more node and more loops.
The scripts asks for the name of the csv file, so you are not bound to a physical file. Only the location of the file is hardcoded.
No comments:
Post a Comment