I have a powershell script which loads data from an xml. The XML looks like:
<meta>
<log>
<path>D:\logs\l1.log</path>
<lastwrite>01/30/2015 13:01:00</lastwrite>
<num>23</num>
</log>
<log>
<path>D:\log\l2.log</path>
<lastwrite>02/30/2015 14:02:00</lastwrite>
<num>67</num>
</log>
</meta>
What I would like to do is to change a certain value in the xml. First I load the Data:
[xml]$xml = Get-Content "D:\config.xml"
My problem is, how can I address a certain log-Node in my xml? What I'm searching for is something like this:
$xml.meta.log.path | where path = "D:\log\l2.log"
And also something to set the new value and save it back to the xml-file.
Maybe sb can help me, I have now idea how to search, but I'm sure there's a way. To use IDs within the log-tags is not a good solution, because I have to address the nodes by the paths.