Need help using a VBscript to edit a single XML file. I've found many examples to edit xml values and I've frankensteined them to edit my xml file, but have not been successful.
My xml file looks like this:
<?xml version="1.0" encoding="utf-8" ?>
- <configuration>
<add key="kiosk_identifier" value="PC1" />
<add key="kiosk_gui_skin" value="FLA" />
</configuration>
I would like the script to go in and edit value "PC1" to a variable entered by the user in an input box. My bastardized code looks as follows.
Set xmlDoc = _
CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = "False"
xmlDoc.Load("C:\Scripts\Configuration.xml")
Set colNodes=xmlDoc.selectNodes _
("//configuration['@add key'='PC1']")
strNAME = Inputbox("Enter a hostname:", "Hostname Config", "HOSTNAME")
For Each objNode in colNodes
objNode.Text = strNAME
Next
xmlDoc.Save "C:\Scripts\Configuration.xml"