I have some XML that is driving me crazy. I'm trying to simply update the XML file located in $env:USERNAME\Appdata\Local\file.xml. I cannot for the life of me work out how to find the value for SoftPhoneHotDeskExtension & SoftPhoneHotDeskCode and update them.
<NavigatePro>
<UserPref>
<Attribute Name="NavigateProInstalling">
<Value>0</Value>
<Type Value="4">DWord</Type>
</Attribute>
<Attribute Name="PlantronicsHeadsetSupportEnable">
<Value>0</Value>
<Type Value="1">String</Type>
</Attribute>
<Attribute Name="SoftPhoneHotDeskExtension">
<Value>999</Value>
<Type Value="1">String</Type>
</Attribute>
<Attribute Name="SoftPhoneHotDeskCode">
<Value>888</Value>
<Type Value="1">String</Type>
</Attribute>
</UserPref>
</NavigatePro>
I can list them out by name by using:
[xml]$XMLfile = Get-Content c:\users\$env:USERNAME\Appdata\Local\file.xml
$XMLFile.NavigatePro.UserPref.Attribute
This will show me the list of attributes by name and value but I cannot fathom how to update them and save them back. I have looked at XPath and using SingleNode but to no avail. Most of the errors come back stating they cannot find the node I'm looking for.