Import Export IP list on Allowed Relay Receive Connector

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

Author: Mike

owner of blog

4 thoughts on “Import Export IP list on Allowed Relay Receive Connector”

  1. 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

  2. look for a way on how to Export and Import Relay from a Windows 2008 server to Windows 2008-R2 without an exchange server

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s