Save PSO parameters for backup/reporting

Hello,

Hereunder a nice way of saving PSO’s parameters for backup, restore or reporting :

Get-ADFineGrainedPasswordPolicy -Identity NeverExpire | Export-Clixml -Path "C:TempPSO.xml"

This retrieve the PSO named “NeverExpire” and then export the “object” in a XML format to the disk.

If you import the XML back :

Import-Clixml .PSO.xml

Import-CliXML

You have the PSO object, but without its methods :

Import-CliXML.Get-Member

If you look at the type name, you’ll see that this is a “Deserialized” version of the original object.

I personally love the ability of exporting object for re-use later. You can use that with all kind of object.

It allows you to do something like :

Import-CliXML-Set-PSO

You can repeat the operation with all parameters, even with the “TimeSpan” parameter type, which can be pretty annoying to type.

Leave a Reply