PowerTip: Difference Between XML PowerShell Cmdlets

Doctor Scripto

Summary: Understand the difference between XML cmdlets in Windows PowerShell.

Hey, Scripting Guy! Question What is the difference between the Windows PowerShell cmdlets, Export-CliXML and ConvertTo-XML?

Hey, Scripting Guy! Answer 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.


Discussion is closed.

Feedback usabilla icon