Author Posts

November 8, 2017 at 6:45 pm

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?

November 8, 2017 at 7:15 pm

Hi

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

Regards

Jake

November 8, 2017 at 9:10 pm

See

'blogs.technet.microsoft.com/heyscriptingguy/2012/09/13/powertip-use-powershell-to-easily-read-an-xml-document'
'blogs.technet.microsoft.com/heyscriptingguy/2014/02/11/powertip-use-powershell-to-edit-xml-file'