PowerTip: Difference Between XML PowerShell Cmdlets

PowerTip: Difference Between XML PowerShell Cmdlets

  • Comments 1
  • Likes

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.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment