Working with XML files

I’m having a hard time understanding how to read XML files, and how to edit it. I’m not sure where to go from here.

$xmlfile = "path to the xml file"
[xml] $readxml = Get-Content $xmlfile

How would I access the elements in the xml file?


Pipe it to Get-Member and start to look around. It might be something like $readxml.something or $readxml.something.else




PowerTip: Use PowerShell to Easily Read an XML Document - Scripting Blog
PowerTip: Use PowerShell to Edit XML File - Scripting Blog