If you are migrating from Exchange 2003 to 2010, when you export the list of allowed relay devices, following this article http://support.microsoft.com/kb/935635 the output will typically be in this format:
10.1.0.1 10.1.0.2 10.1.0.3 10.1.0.6 10.1.0.7 10.1.0.8
Name the file IPList.txt
So, with the script below, you can import the list of ip addresses on your receive connector
$RecvConn = Get-ReceiveConnector "Ex2010\AllowedRelay" Get-Content .\IPList.txt | foreach {$RecvConn.RemoteIPRanges += "$_"} Set-ReceiveConnector "Relay Connector" -RemoteIPRanges $RecvConn.RemoteIPRanges
When you are migrating from Exchange 2007 to 2010, we use powershell command to export the list, and a powershell script to import
Here is the powershell command to export the list. Change the exchange 2007\allowedrelay part to be the correct server\receive connector name.
(Get-ReceiveConnector "exchange2007\allowedrelay").RemoteIPRanges | select Lowerbound,Upperbound,RangeFormat | sort-object Lowerbound| export-csv c:\rc.txt –NoTypeInformation
Use this script to import it onto the exchange 2010, change the second line to be the correct exchange 2010 server name \ receive connector name
$csv = "c:\rc.txt" $rc = "EX2010\RelayConnector" $impcsv = import-csv $csv foreach($line in $impcsv) { $ipAdd = $line.LowerBound $conn = Get-ReceiveConnector $rc $conn.RemoteIPRanges += $ipAdd Set-ReceiveConnector $rc -RemoteIPRanges $Conn.RemoteIPRanges }
Advertisements
Thanks for a documenting and creating a great script. I have numerous connectors to configured with hundreds of IPs that need importing.
Yes thank you, this one came in useful for me.
I am getting the following error when I try the script.
he term ‘Get-ReceiveConnector’ is not recognized as the name of a cmdlet, function, script file, or operable program
look for a way on how to Export and Import Relay from a Windows 2008 server to Windows 2008-R2 without an exchange server