So I've a little with my PowerShell script and XML file.
Currently the XML file is formated like this :
<?xml version="1.0" encoding="utf-8"?>
<Settings>
<ARP>
<ConfigVLAN>
<Vlan>Vlan1</Vlan>
<Vlan>Vlan2</Vlan>
<Vlan>Vlan3</Vlan>
<Vlan>Vlan4$</Vlan>
</ConfigVLAN>
</ARP>
</Settings>
function modifyXmlItem ($selectedItem, $newValue) {
$node = $xml.Settings.ARP.configVLAN | where {$_ -eq $selectedItem}
$node = $newValue
$xml.Save($path)
}
Try this:
$xml = [xml]'<?xml version="1.0" encoding="utf-8"?>
<Settings>
<ARP>
<ConfigVLAN>
<Vlan>Vlan1</Vlan>
<Vlan>Vlan2</Vlan>
<Vlan>Vlan3</Vlan>
<Vlan>Vlan4$</Vlan>
</ConfigVLAN>
</ARP>
</Settings>'
$selectedItem = 'Vlan4$'
$xml.Settings.ARP.ConfigVLAN.SelectSingleNode("Vlan[text()=""$($selectedItem)""]").InnerText = "NewValue"
$xml.Save('d:\temp\out.xml')