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

Topic Last Modified: 2012-07-23

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:

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.

Copy Code
$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.

Copy Code
$ 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.

Caution:
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.

Copy Code
[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.