Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Vbscript for XML editing is not working in win server 2008 R2, same script working in other platform(win xp , 7, 8)

$
0
0

Please look in to the script.

Set xmlDoc = CreateObject("Microsoft.XMLDOM")
XMLDir = "C:\"
xmlPath = quote & XMLDir & "123.xml" & quote
xmlDoc.load xmlPath

'Locate the desired node
'Note the use of XPATH instead of looping over all the child nodes
Set nNode = xmlDoc.selectsinglenode ("//AutomatedInstallation/instance/entry")
Set nNode_AuthorizedServerHost = xmlDoc.selectsinglenode ("//AutomatedInstallation/agent.parameters/entry[@key=""field.Authorized.Controlm.Server.Host""]")
Set nNode_ServerPortNum = xmlDoc.selectsinglenode ("//AutomatedInstallation/agent.parameters/entry[@key=""field.Agent.To.Server.Port.Number""]")
Set nNode_AgentPortNum = xmlDoc.selectsinglenode ("//AutomatedInstallation/agent.parameters/entry[@key=""field.Server.To.Agent.Port.Number""]")
Set nNode_Password = xmlDoc.selectsinglenode ("//AutomatedInstallation/agent.parameters/entry[@key=""ctm_agent.Service.User.Password""]")
Set nNode_PrimaryServerHost = xmlDoc.selectsinglenode ("//AutomatedInstallation/agent.parameters/entry[@key=""field.Primary.Controlm.Server.Host""]")

value1 = "123"
value2 = "456"
value3 = "789"
value4 = "1234"
value5 = "5678"
value6 = "987"

nNode.setAttribute "value", value6
nNode_AuthorizedServerHost.setAttribute "value", value1
nNode_ServerPortNum.setAttribute "value", value2
nNode_AgentPortNum.setAttribute "value", value3
nNode_Password.setAttribute "value", value4
nNode_PrimaryServerHost.setAttribute "value", value5

'Save the xml document with the new settings.
strResult = xmldoc.save(xmlPath)

Please go through the script and suggest where is problem that the script is not working on Windows Server 2008 R2 platform,

Error : "Runtime Object required : XX****" @ "nNode.setAttribute "value", value6" , this location

Please suggest your valuable taughts or information you know on this,


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>