3 ms·
> You can print them, but you can't serialise them in a way that can be later unserialised. Nope, that's wrong: Export-CliXml Import-CliXml (https://
by useerup 10y ago
> You can print them, but you can't serialise them in a way that can be later unserialised.
Nope, that's wrong:
Export-CliXml
Import-CliXml
(https://technet.microsoft.com/en-us/library/hh849916.aspx https://technet.microsoft.com/en-us/library/hh849916.aspx)
For instance:
PS> ps|Export-Clixml myprocesses.xml
PS> Import-Clixml .\myprocesses.xml
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
297 15 3856 13304 4024 0 aeagent
88 7 1420 4808 3804
...
CliXml (Command Line XML, IIRC) is a serialization format for PowerShell objects. It is the format used to transfer objects to/from remote machines when PS remoting is used.
Granted, the re-hydrated objects are not the original objects. Most method will not work after re-hydration as the object has been ripped from it's context. Think ProcessInfo (the objects returned from 'ps' (Get-Process)) - in it's original form it can be used to interact with the process, e.g. terminating it. In the rehydrated form it can be used only to inspect properties.
Speaking from experience, this is rarely a problem. CliXML works remarkably well.