Saturday , June 23 2018

Export and Import Transport Rules in Exchange Online

Lets see in a hybrid in Environment. We got to move the transport Rules from On-Premises Server to Office 365. So that transport rules will still work when mail flow hits the cloud for Mail processing.

Export XML file from On premises Server –

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

image

Connect to Exchange Online PowerShell –

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session

Import XML file to Office 365  –

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

Note : Import from Exchange 2010 Server is not Supported.  Error : It cannot be used with a engine-based XML File is Datacenter Environment.

image

About Satheshwaran Manoharan

Satheshwaran Manoharan is an Microsoft Exchange Server MVP , Publisher of CareExchange.in
Supporting/Deploying/Designing Microsoft Exchange for some years.
Extensive experience on Microsoft Technologies.

Check Also

Your device won’t be able to synchronize with the server via Exchange ActiveSync because of an access policy defined on the server

iOS device – The Connection to the server Failed. Get-CASMailbox -Identity MailboxName| fl Set-CASMailbox MailboxName ...

Leave a Reply

Your email address will not be published.