The situation that many Exchange administrators are in, is a simple one. Multiple CAS servers for redundancy and fault tolerance, as well as load balancing either inside the cluster, or on the outside using something like a Citrix Netscaler or F5 device. This is a natural design for Exchange 2010 and provides great functionality and recovery capability.
There are also many designs which use a single server, or perhaps a single server per site contains Receive Connectors for inbound relay based on a set of criteria such as auth type or network range.
The challenge for Receive Connectors, and especially with network ranges applied, is that they are difficult to re-create on another server. Whether it is on your first creation, or if you want to make a copy on another server for active or passive use, PowerShell can be your best friend for this task.
Assuming that we have two servers named EXSITE1 and EXSITE2 where we have created our Receive Connector named Default-App-Connector on EXSITE1 but we want to have it on EXSITE2. While we can create one easily enough using the New-ReceiveConnector CmdLet we have to type in all of the IP ranges manually which is both tedious and error prone.
Here is your solution. The basic command for creating the new backup connector is:
New-ReceiveConnector “Default-App-Connector” -Server EXSITE2 -Bindings 0.0.0.0:25
The problem is that this only creates the connector, but not the IP ranges. As I mentioned, if we type the allowed IP addresses and ranges into the command using the -RemoteIPRanges parameter I have a lot of work ahead of me.
So we simply read the -RemoteIPRanges from the first connector and pass them to the New-ReceiveConnector CmdLet just like so:
New-ReceiveConnector “Default-App-Connector” -Server EXSITE2 -Bindings 0.0.0.0:25 -RemoteIPRanges ( Get-ReceiveConnector “EXSITE1Default-App-Connector” ).RemoteIPRanges
You can also use the Get-ReceiveConnector to document your configuration to file, which is a good practice for BCP. Because these can be volatile, I recommend you export to disk, or replicate to the second server weekly or monthly.
Simply use this command:
Get-ReceiveConnector “EXSITE1Default-App-Connector” | Format-List | Out-File “X:ExchangeConfigurationDefault-App-Connector.txt”
It’s just that easy. A simple command that can provide peace of mind and protection. Hopefully you find this to be helpful.
4 thoughts on “PowerShell – Copy Exchange 2010 Receive Connectors Between Servers”
Thanks, this is very simple and dead handy for the boat loads of servers that I need to relay email.
Great stuff Ben! I’m glad that it will help. It is one of those tasks that isn’t done often, but still nice to have it be scripted 🙂
Thank you for this awesome tip! Saved me quite a bit of time. Would you have any resources (books, articles) that you would recommend for moving Exchange 2010 to new hardware?
Thanks for the great feedback!! For resources on moving to new hardware, that’s a good question. I usually lean on the Technet blogs for that. For hardware migration I typically do new servers to expand the roles on the additional hardware, and then remove the old resources. This lets the natural Exchange clustering and protection do all the work for you 🙂