Recently I needed to set up a new receive connector at a remote site that was internet facing so that mail was only accepted from a hosted spam filter, the list of IPs that needed to be added was already configured on another Receive connector at another site so I did a bit of googling and found this powershell command.
Set-ReceiveConnector “SERVER2\ReceiveConnector” -RemoteIPRanges ( Get-ReceiveConnector “SERVER1\ReceiveConnector” ).RemoteIPRanges
In this example I had already created the Receive Connector as I was going to add them manually but then decided against it, however if you wanted to start from scratch you could just as easily use New-ReceiveConnector with the correct switches and this will still work.
Server1 = Old server from which you plan to copy the IPs from
Server2 = The new server which you will be editing
To verify that the copy worked run the below command and you should see all the IPs in your new ReceiveConnector!
Get-ReceiveConnector “SERVER2\ReceiveConnector” |fl remoteipranges
*As a side note, I noticed when I ran the above command it would only list a few of the remoteipranges before trailing off, if you want to see all the data run the below command
(Get-ReceiveConnector SERVER2\ReceiveConnector).remoteipranges > C:\Server2-ReceiveConnector.txt
It will create a text file on your C: drive named Server2-ReceiveConnector.txt the output isn’t pretty but at least it’s all there.
One last thing, whilst I’ve only talked about Receive Connectors this will apply to Send connectors, you could also modify the script to work with any value that you wanted to copy or manipulate.