Quantcast
Channel: How to update an Xml Element value using PowerShell
Viewing all articles
Browse latest Browse all 6

How to update an Xml Element value using PowerShell

$
0
0

I've been tryign to get this to work. Without any luck.

Given the following Xml:
<data>
  <variable name="MPS">
    <row>
      <column>RPS</column>
      <column>500</column>
    </row>
  </variable>
</data>

How would I update the second "column" value of 500?

#$xml = New-Object XML
#$xml.Load("<XmlFile>")

$xml.data.variable.row.column  -> returns MPS and 500 as expected
$xml.data.variable.row.column[1] -> returns 500 as expected
$xml.data.variable.row.column[1] = $Variable ->  does not work

 

Thanks   :)

TR


Viewing all articles
Browse latest Browse all 6

Trending Articles



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