Support converting to/from clixml format without unnecessary file I/O
Votes from Connect: 15
Original Date Submitted: 3/2/2010 4:05:15 AM
Handle: Kirk Munro (Quest Software)
Site Name: PowerShell
Feedback ID: 537755
Frequency: Always Happens
Regression: Yes, this happens in all previous versions
Today you can export PowerShell objects using Export-Clixml and then import them deserialized using Import-Clixml. The trouble with this is that you don't always want to use an external file. Sometimes you want an external file, sure, but many other times you want to store the deserialized object data elsewhere or you want to pass it across a remote connection to a client, etc.
The PowerShell Team should consider supporting these scenarios such that the file I/O is only required if the Import-/Export-Clixml cmdlets are used and such that the conversion can happen in both directions without the file I/O. I originally envisioned this support would come in the form of ConvertTo-Clixml and ConvertFrom-Clixml cmdlets, however Lucasz had some other ideas. He proposed 3 (not mutually exclusive) ways of fixing this:
- Make Serialization API public
- Add ConvertTo-CliXml and ConvertFrom-CliXml cmdlets
- Make Export-CliXml support IContentWriter and then use it like: Export-CliXml –Path Variable:x # instant RAM disk…
Any of these approaches would be useful, as long as it would be possible in a supported scenario in PowerShell
Product Studio item created by Connect Synchronizer due to creation of feedback ID 537755 (http://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=537755).
Try to convert a collection of objects to clixml format without creating a file and then converting that collection back into deserialized objects in PowerShell.
You should be able to do this in memory in PowerShell without using the file system.
Internal BugId: 2444
It is already implemented with [System.Management.Automation.PSSerializer]::Serialize and [System.Management.Automation.PSSerializer]::Deserialize static methods.