PowerTip: Difference Between XML PowerShell Cmdlets
Summary: Understand the difference between XML cmdlets in Windows PowerShell.
What is the difference between the Windows PowerShell cmdlets, Export-CliXML and ConvertTo-XML?
The Help file for ConvertTo-XML says:
“This cmdlet is similar to Export-CliXML, except that Export-CliXML stores the resulting XML in a file.
ConvertTo-XML returns the XML, so you can continue to process it in Windows PowerShell.”
The Export verb encapsulates your objects in a persistent data store (such as a file) or into an
interchange format. The ConvertTo verb simply changes the objects in the pipeline for continued use.
If you follow ConvertTo-XML with Out-File, you would get similar results to Export-CliXML.