Copy receive connectors

Brass Contributor

I'm migrating from Exchange 2010 to 2016 and I was looking for a way to copy all the Ex2010's Receive Connectors to Ex2016.

I found a script on github that should do just that but it fails with the following error

 

Cannot process argument transformation on parameter 'RemoteIPRanges'. Cannot convert value "172.22.0.0/16
172.21.0.0/16" to type "Microsoft.Exchange.Data.MultiValuedProperty`1[Microsoft.Exchange.Data.IPRange]". Error:
"Cannot convert value "172.22.0.0/16" to type "Microsoft.Exchange.Data.IPRange". Error:
"SerializationTypeConverter.DeserializeObject(Microsoft.Exchange.Data.IPRange). Type is not allowed for custom
construction. Deserialization Failed Error: System.Exception: SerializationData is not signed.
at Microsoft.Exchange.Data.SerializationTypeConverter.VerifySerializationDataAndGetOriginalSerializationData(Byte[]
serializationData, Boolean mustVerify)
at Microsoft.Exchange.Data.SerializationTypeConverter.DeserializeObject(Object sourceValue, Type destinationType)""
+ CategoryInfo : InvalidData: (:) [New-ReceiveConnector], ParameterBindin...mationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,New-ReceiveConnector

 

I tried even this simple command
New-ReceiveConnector -Name "Connector" -Server $TargetServer -Usage Custom -TransportRole FrontEndTransport -PermissionGroups AnonymousUsers -Bindings 0.0.0.0:25 -RemoteIPRanges (Get-ReceiveConnector "$SourceServer\Connector").RemoteIPRanges -MaxMessageSize (Get-ReceiveConnector "$SourceServer\Connector").MaxMessageSize

 

but it fails with exact the same error while getting the RemoteIpRange

 

7 Replies
Not being very good a scripting, I tend to just use a one-liner for this:

New-ReceiveConnector <Relay name> -Server <server name> –AuthMechanism TLS,ExternalAuthoritative –PermissionGroups AnonymousUsers,ExchangeServers –MaxMessageSize 30MB –TransportRole FrontendTransport -RemoteIPRanges (Get-ReceiveConnector <existing receive connector ie: "ExchangeServer01\Anonymous Relay">).RemoteIPRanges -Bindings 0.0.0.0:25

There are a few properties you can configure as part of this.
Hello DAN,
Unfortunately this does not work, is exactly the same command that is included in the script provided by github community and same command I tried myself.
The problem is that, for whatever reason, the parameter -RemoteIPRanges is not accepting the input
-RemoteIPRanges (Get-ReceiveConnector "$SourceServer\GPRS").RemoteIPRanges
The error is always that the format of IP is not correct and cannot be converted.

So far I had to create a script that cycles for each connector's remote IP ranges and ADD them to the new connector once created.

@Stefano Colombo Instead of using the Exchange Management Shell, start Powershell and load the snap-in directly. See if that makes any difference in handling.

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Snapin

 

@Stefano ColomboI have used the below command successfully at various customers, although not on Exchange 2010. Try them and see if it makes a difference.

 

Get the current receive connector you want to copy and verify IPs:

(Get-ReceiveConnector -Identity "<ServerName\ConnectorName>").RemoteIPRanges | Sort-Object | Format-Table

 

Copy the connector to the target server:

New-ReceiveConnector -Name "<Connector Name>" -Server "<TargetServerName>" -Usage Custom -TransportRole FrontEndTransport -PermissionGroups AnonymousUsers -Bindings 0.0.0.0:25 -RemoteIPRanges (Get-ReceiveConnector "<ServerName\ConnectorName>").RemoteIPRanges

 

Just change your permission groups to what they need to be if not AnonymousUsers.

 

Hope this helps

Hello Thomas,
Thanks for your suggestion but it’s the same command I tried.
I’m pretty sure, since I used it too in the past, that the issue is related to exchange 2010.
I used that command to copy receive connector between the two exchange 2016 servers that are going to replace the 2010 without any issue,
I solved the problem by creating a script that reads the remote receive connectors and cycle them one at time and using a temporary file for remote IP ranges creates the new connectors on 2016
Hi Stefano,
I suspect that you are correct in you assessment that it is 2010 related, the oldest version I have used it on was 2013. Glad to hear you found a solution though!
I just tested this myself. The existing environment is Exchange Server 2010. I installed a new Exchange Server 2016 server and ran this cmdlet and it created the new receive connector and copied the IP addresses from an Exchange Server 2010 server without issue. It must be something specific to your environment. Did you run the cmdlet from the Exchange Server 2016 server?