07 October 2013

Export Receive connector RemoteIpRanges

Backing up your Receive connector RemoteIpRanges seem like a good idea, to me at least.
We currently have several hundred ip addresses added to our relay connector.

Losing all that work by some(ones) mistake would take a lot of work to recreate.

So here's how to do it:

First set your output higher, otherwise more than 16 ip addresses added to your connector will be truncated in the powershell output.
[PS] C:\>Get-ReceiveConnector "Relay Connector" | fl remoteipranges


RemoteIPRanges : {10.0.0.14, 10.0.0.20, 10.0.0.19, 10.0.0.18, 10.0.0.17, 10.0.0
                 .16, 10.0.0.15, 10.0.0.10, 10.0.0.9, 10.0.0.8, 10.0.0.7, 10.0.
                 0.6, 10.0.0.5, 10.0.0.4, 10.0.0.13, 10.0.0.12...}
As you can see the ...} at the end of the output means there's more than Powershell shows.

To unlimit the output for your current Powershell session:
$FormatEnumerationLimit =-1

Now we can list all the output to a file:
[PS] C:\>Get-ReceiveConnector "sr-XXXXX\smtp relay" | fl remoteipranges
 | out-file "d:\temp\smtp relay sr-XXXX.txt"
This file can be edited to your needs.
Source

No comments:

Post a Comment