Quantcast
Channel: Active questions tagged powershell-3.0 - Stack Overflow
Viewing all articles
Browse latest Browse all 134

How to properly export XML to file using Powershell

$
0
0

Importing any valid XML file as source using [XML]$Var = Get-Content -Path $PathToAnyValidXML I am unable to export it's content properly.

Using Set-Content SomePath $Var , the file ends with System.Xml.XmlDocument as content.

Using $Var | Export-Clixml SomePath , the file ends with the original XML inside an XML

What is a correct method to write raw XML to a file properly ? (Get the exact same content that was on $PathToAnyValidXML once it was imported to a variable on Powershell)

If we need to use XPath or Objects, provide example with both method if possible.


Viewing all articles
Browse latest Browse all 134

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>