Import & Export Transport rules in 365 Exchange

On this article we will learn how to export and import transport rules in our exchange

What Transport rules do?

You can use mail flow rules (also known as transport rules) to identify and take action on messages that flow through your Exchange Online organization. Mail flow rules are similar to the Inbox rules that are available in Outlook and Outlook on the web

This can be useful to :

  • Save a backup
  • Check previous rules or new rules
  • Roll back any changes made on this configuration

Step 1. Connect to Exchange online

Guidance’s of how to install the module can be find here:

https://docs.microsoft.com/en-us/powershell/exchange/connect-to-exchange-online-powershell?view=exchange-ps

Step 2 Export the Actual Rules

Execute the following to export the XML in your machine

$file = Export-TransportRuleCollection

Set-Content -Path "C:\Scripts\Rules.xml" -Value $file.FileData -Encoding Byte


Importing the XML in case of need

Execute the following commands to Import the XML from your machine into Exchange

[Byte[]]$Data = Get-Content -Path "C:\Scripts\Rules.xml" -Encoding Byte -ReadCount 0

Import-TransportRuleCollection -FileData $Data
Advertisement

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 )

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.