Jaa


Export and Import Transport Rules

 

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

You may need to export and import the transport rule collection from one transport server running Microsoft Exchange Server 2010 or Exchange Server 2007 to another transport server in the following scenarios:

  • Duplicate transport rule configuration on Edge Transport servers   Make sure all Edge Transport servers or a set of Edge Transport servers apply the same transport rules. Hub Transport servers store their configuration in Active Directory. The configuration is replicated to all domain controllers in the organization. Edge Transport servers store their configuration in the local instance of Active Directory Lightweight Directory Services (AD LDS), which is not automatically replicated.

    Depending on your Exchange deployment and message routing topology, you may want to have different sets of Edge Transport servers use different transport rules. For example, you may want to apply different rules on the Edge Transport servers that receive inbound e-mail than the ones on the Edge Transport servers that send outbound e-mail. If you want all Edge Transport servers in your organization to apply the same set of transport rules, you can use this procedure to duplicate the transport rule configuration.

    If you want to replicate the entire Exchange configuration from one Edge Transport server to another, we recommend that you use a cloned configuration. This configuration includes the configuration of transport rules on an Edge Transport server. For more information about how to clone Edge Transport servers, see Understanding Edge Transport Server Cloned Configuration.

    Important

    If you expect frequent changes to the transport rule configuration on Edge Transport servers, we recommend that you designate one Edge Transport server as a source server and perform modifications on that server. Configure the other Edge Transport servers to automatically update their transport rule configuration from the source Edge Transport server by using a Shell script that performs the procedures later in this topic. For more information about how to run scripts in the Shell, see Scripting with the Exchange Management Shell.

  • During coexistence with Exchange 2007 Hub Transport servers   Exchange 2010 includes many new transport rule predicates and actions, and changes to some predicates and actions found in Exchange 2007. When you install the first Exchange 2010 server in your Exchange 2007 organization, Exchange Setup creates a container in Active Directory to hold Exchange 2010 rules, resulting in rules for both versions being stored in different locations. Any existing transport rules from Exchange 2007 are converted, and a copy is stored in the Exchange 2010 container. After setup, the Exchange organization has the same set of transport rules for both Exchange server versions.

    Subsequently, if you make any changes to the transport rule configuration on Exchange 2007 or Exchange 2010, both versions will have a different set of rules. To ensure both Exchange server versions have the same transport rules and to apply the same messaging policies, make sure that any changes you make to the transport rule configuration on Exchange 2007 are also made to the Exchange 2010 configuration. This procedure helps you export rules from Exchange 2007 and import them in Exchange 2010.

    Important

    To export Exchange 2007 transport rules to an Exchange 2010 server, you must run the Export-TransportRuleCollection cmdlet on an Exchange 2010 server. The Export-TransportRuleCollection cmdlet includes the option to export Exchange 2007 rules.
    When you import Exchange 2007 transport rules to an Exchange 2007 server, you must run the Import-TransportRuleCollection cmdlet on an Exchange 2007 server.
    You can't export Exchange 2010 rules and import them to an Exchange 2007 server.

Looking for other management tasks related to transport rules? Check out Managing Transport Rules.

Use the Shell to export Exchange 2010 transport rules from a Hub Transport or an Edge Transport server

You need to be assigned permissions before you can perform this procedure. To see what permissions you need, see the "Transport rules" entry in the Messaging Policy and Compliance Permissions topic.

Note

You can't use the EMC to export Exchange 2010 transport rules from a Hub Transport or an Edge Transport server.

The procedure to export Exchange 2010 transport rules is the same for both Hub Transport and Edge Transport servers. On the Hub Transport server, you may want to export transport rules to be imported on an Exchange 2010 Hub Transport server during coexistence. Or you may want to export transport rules for backup purposes.

On Edge Transport servers, you may want to export transport rules to duplicate them on another Edge Transport server, or to back up the transport rules on that Edge Transport server.

This example exports transport rules on an Exchange 2010 Hub Transport or Edge Transport server. Rule data is exported to the variable $file, and then written to the Exchange2010TransportRules.xml file in the C:\MyDocs folder.

$file = Export-TransportRuleCollection
Set-Content -Path "C:\MyDocs\Exchange2010TransportRules.xml" -Value $file.FileData -Encoding Byte

For detailed syntax and parameter information, see Export-TransportRuleCollection.

Use the Shell to export Exchange 2007 transport rules from an Exchange 2010 Hub Transport server

You need to be assigned permissions before you can perform this procedure. To see what permissions you need, see the "Transport rules" entry in the Messaging Policy and Compliance Permissions topic.

Note

You can't use the EMC to export Exchange 2007 transport rules from an Exchange 2010 Hub Transport server.

You may need to export Exchange 2007 transport rules to import them to an Exchange 2010 Hub Transport server during a period of coexistence when you have both Exchange versions in your organization. When you set up the first Exchange 2010 server in your Exchange 2007 organization, Exchange Setup copies the rules from the Exchange 2007 transport rule container to the Exchange 2010 container. You need to perform this procedure only if you have made changes to transport rules on an Exchange 2007 server, and need to make the same changes to the Exchange 2010 server to make sure both servers have the same transport rules.

This example exports legacy transport rules created in Exchange 2007. Run the command from an Exchange 2010 Hub Transport server.

$ file = Export-TransportRuleCollection -ExportLegacyRules
Set-Content -Path "C:\MyDocs\LegacyRules.xml" -Value $file.FileData -Encoding Byte

For detailed syntax and parameter information, see Export-TransportRuleCollection.

Use the Shell to import transport rules on an Exchange 2010 Hub Transport or Edge Transport server

You need to be assigned permissions before you can perform this procedure. To see what permissions you need, see the "Transport rules" entry in the Messaging Policy and Compliance Permissions topic.

Note

You can't use the EMC to import transport rules on an Exchange 2010 Hub Transport or Edge Transport server.

Use this procedure to import Exchange 2010 or Exchange 2007 transport rules on an Exchange 2010 Hub Transport or Edge Transport server. Both the server roles use the same procedure and cmdlet to import transport rules.

Warning

Importing a transport rule collection from a .xml file removes or overwrites all preexisting transport rules defined for the Transport Rules agent. Make sure that you have a backup of your current transport rule collection before you import and overwrite the transport rules.
On Hub Transport servers, the Import-TransportRuleCollection cmdlet overwrites all transport rules configured in the Exchange 2010 organization, except for transport rules on Edge Transport servers. On Edge Transport servers, this command overwrites transport rules configured on the local computer only.

Important

Although similar in concept and implementation, the Hub Transport and Edge Transport server roles use different transport rule predicates and actions designed to meet different requirements. You shouldn't import transport rules exported from an Edge Transport server from either Exchange version to a Hub Transport server of either version. Similarly, you shouldn't import rules exported from a Hub Transport server from either Exchange version to an Edge Transport server of either version.

This example imports transport rules from the ExportedRules.xml file.

[Byte[]]$Data = Get-Content -Path "C:\MyDocs\ExportedRules.xml" -Encoding Byte -ReadCount 0
Import-TransportRuleCollection -FileData $Data

For detailed syntax and parameter information, see Import-TransportRuleCollection.

 © 2010 Microsoft Corporation. All rights reserved.