Friday , April 19 2019

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

Decommissioning Child Domain gracefully – Operation Failed

If the domain is a Child domain and if you wish to delete Child domain ...

Leave a Reply

Your email address will not be published.