Frequently, I am asked to make changes to a customer's environment. I'm a belt and suspenders kind of guy, so my backups have backups. At any rate, normally when I am performing changes in a tenant (or Exchange on-premises environment, for that matter), I make two sets of backups–one by piping a Get-cmdlet to Export-CSV (so I have a readable copy), and one by piping the same Get-cmdlet to Export-Clixml (so I have a way to set the nodes as parameters and import them back).
For today's example, I'm going to modify the "DeliveryReportEnabled" property of an organization relationship and then restore it from an XML backup.
First, capture the organization relationship settings and review them on-screen. To do this, I ran Get-OrganizationRelationship | FL.
So, we can see all of the parameters and their current configuration here.
Next, we're going to back it up using the Export-Clixml cmdlet. I ran Get-OrganizationRelationship | Export-Clixml c:\temp\aaron_org.xml to save all of the settings to an XML file.
If you open it up, you can see the nodes and values.
Now that we have a backup, we can proceed with making changes. Since I only have one organization relationship, I can just run Get-OrganizationRelationship | Set-OrganizationRelationship -DeliveryReportEnabled $False to update the parameter. Otherwise, I'd need to specify the identity.
After the command returns, check the value with Get-OrganizationRelationship | Select DeliveryReportEnabled.
Once I've verified that the parameter has taken effect, I want to import the backup I made and set the parameter back to default. To do that, I use Import-Clixml to import the XML data and then can reference the nodes as parameter names. In this command, I run:
$ConfigBackup = Import-Clixml C:\temp\aaron_org.xml
Set-OrganizationRelationship -Identity $ConfigBackup.Identity -DeliveryReportEnabled $ConfigBackup.DeliveryReportEnabled
Since I'm lazy, I'll just run Get-OrganizationRelationship | Set-OrganizationRelationship -DeliveryReportEnabled $ConfigBackup.DeliveryReportEnabled.
Then, I can verify that it was completed using same command I used previously: Get-OrganizationRelationship | Select DeliveryReportEnabled.
Easy peasy. The takeaway is that configuration parameters are very easy to reference using XML. You should be able to do this with any product that has a PowerShell interface and that you can export to Clixml. Happy backup and restoring!