Applies to: Exchange Server 2010 SP3, Exchange Server 2010 SP2

Topic Last Modified: 2012-07-23

This topic explains how to use the Exchange Management Shell to import address rewrite entries into a computer that has the Microsoft Exchange Server 2010 Edge Transport server role installed.

The following are some of the common scenarios in which you may want to perform a bulk import of address rewrite entries:

If you have more than one Edge Transport server, we recommend that you use the following procedures to import address rewrite entries into a single Edge Transport server, and then clone the configuration of that Edge Transport server to other Edge Transport servers in your organization. For more information about how to clone an Edge Transport server, see Understanding Edge Transport Server Cloned Configuration.

Looking for other management tasks related to address rewrite entries? Check out Managing Transport Agents.

Prerequisites

You must be familiar with how to create an address rewrite entry before you try to use comma-separated value (CSV) files to perform bulk imports of address rewrite entries. For information, see Create an Address Rewrite Entry.

You need to be assigned permissions before you can perform this procedure. To see what permissions you need, see the "Address Rewriting agent" entry in the Transport Permissions topic.

Step 1: Create a CSV file

First, you must create a CSV file that contains columns of values that correlate to the parameters that are required by the New-AddressRewriteEntry cmdlet. The following values are required by the New-AddressRewriteEntry cmdlet and therefore must have corresponding columns in the CSV file:

  • Name   This parameter must be a string that uniquely identifies the address rewrite entry.

  • InternalAddress   This parameter specifies the internal SMTP address to be rewritten.

  • ExternalAddress   This parameter specifies the external SMTP address to be rewritten.

The following parameters are optional. You can include columns for them in the CSV file if you need them:

  • ExceptionList   This parameter specifies the list of subdomains that should not be rewritten. No SMTP addresses contained within the specified subdomains are rewritten. You must enclose the values that are used with the ExceptionList parameter in double quotation marks ("). If you want to specify multiple domains that have the ExceptionList parameter, you must separate each value by using commas (,). For example, the string "domain1.com,domain2.com, domain3.com" contains three domains enclosed with double quotation marks and separated by commas.

  • OutboundOnly   This parameter specifies whether the address rewrite entry should rewrite SMTP addresses on messages that are inbound and outbound to the Exchange 2010 organization, or rewrite only those messages that are outbound from the Exchange 2010 organization. Unlike Boolean usage elsewhere in the Shell, when you specify a value for the OutboundOnly parameter in a CSV file, you must specify a value of True or False, not $True or $False. This is because the value in the CSV file is converted to a Boolean value when the CSV file is interpreted on the command line.

    Important:
    If you specify values for optional columns in the CSV file, every row must include a value in that column. This is because the cmdlet expects a value for each parameter specified in the CSV file. If you want to create multiple address rewrite entries where some entries have optional parameters and some entries do not, you must separate those address rewrite entries and create two separate CSV files, and then import each of those CSV files.
    Important:
    You can only specify exception lists for address rewrite entries that are outbound-only. If you use both the ExceptionList and OutboundOnly columns in your CSV file, you can only put outbound-only address rewrite entries in that CSV file.

The following example shows how a CSV file can be populated with the optional ExceptionList and OutboundOnly parameters included:

Copy Code
Name,InternalAddress,ExternalAddress,ExceptionList,OutboundOnly
"Wingtip UK", *.wingtiptoys.co.uk, tailspintoys.com,"legal.wingtiptoys.co.uk,finance.wingtiptoys.co.uk,support.wingtiptoys.co.uk",True
"Wingtip USA", *.wingtiptoys.com, tailspintoys.com,"legal.wingtiptoys.com,finance.wingtiptoys.com,support.wingtiptoys.com,corp.wingtiptoys.com",True
"Wingtip Canada", *.wingtiptoys.ca, tailspintoys.com,"legal.wingtiptoys.ca,finance.wingtiptoys.ca,support.wingtiptoys.ca",True

Step 2: Import a CSV file to create multiple address rewrite entries

You use the New-AddressRewriteEntry cmdlet in conjunction with the Import-CSV cmdlet to bulk import multiple address rewrite entries.

The following example imports the address rewrite entries that are listed in a previously created CSV file named ImportAddressRewriteEntries.csv.

Copy Code
Import-Csv C:\ImportAddressRewriteEntries.csv | ForEach { New-AddressRewriteEntry -Name $_.Name -InternalAddress $_.InternalAddress -ExternalAddress $_.ExternalAddress -OutboundOnly ([Bool]::Parse($_.OutboundOnly)) -ExceptionList $_.ExceptionList}

For detailed syntax and parameter information, see New-AddressRewriteEntry.