I'm getting crazy. I need to modify this XML file in powershell
<Smart>
<Settings>
<Section name="x">
<Parameter name="a" value="true" />
<Parameter name="b" value="0" />
<Parameter name="c" value="13873" />
<Parameter name="d" value="true" />
<Parameter name="e" value="EAI" />
</Section>
<Section name="z">
<Parameter name="h" value="true" />
<Parameter name="i" value="0" />
<Parameter name="j" value="13873" />
<Parameter name="k" value="true" />
<Parameter name="l" value="EAI" />
</Section>
</Settings>
</Smart>
What I want to do is add another line such as:
< Parameter name="f" value="OK" />
But I want to add the new line inside the first Section < Section name="x">
#Modify XML file
Write-Host "OPENING XML FILE";
$path = "\\$computer\$FileName"
[xml] $xml = Get-Content $path
#return $xml.SmartUpdate.Settings.Section.Parameter
#set values for the XML nodes you need. This uses the XPath of the value needed.
**WANT TO ADD THE NEW PARAMETER HERE**
#Save the file
$xml.save($path)
Write-Host "XML FILE SAVED";
I cannot find the solution. Please help me