PowerTip: Use PowerShell to Edit XML File

Doctor Scripto

Summary: Use Windows PowerShell to load an XML file for easy editing.

Hey, Scripting Guy! Question Hey Scripting Guy! Is there an easy way to load and edit an XML file in Windows PowerShell?

Hey, Scripting Guy! Answer It’s so easy that you might miss it if you blink. Create an XML object. With that, you can load, save, and edit properties directly:

$XMLfile=NEW-OBJECT XML

$XMLfile=load(“MyXMLFile.XML”)

$XMLFile.property.otherproperty=”Gibberish”

$XMLFile.save(“MyXMLFile.XML”)

0 comments

Discussion is closed.

Feedback usabilla icon