msxml - create xml value with vbscript -
i need add value of extradataitem name="hostonly/virtualbox host-only ethernet adapter/ipaddress" value="192.168.2.1" xml.. in picture can see how looks after has been added program. in default xml, 2 lines exist in extradata.
can please tell me how using msxml2? tried code, no results :(
set xmldoc = createobject("msxml2.domdocument") xmldoc.setproperty "selectionlanguage", "xpath" xmldoc.load(file1) set objnodelist = xmldoc.getelementsbytagname("dhcpservers") each comnodeitem in objnodelist 'jobname = comnodeitem.getattribute("name") each filenodeitem in comnodeitem.childnodes filename = filenodeitem.getattribute("ipaddress") filenodeitem.setattribute "ipaddress", "192.168.2.10" filename = filenodeitem.getattribute("lowerip") filenodeitem.setattribute "lowerip", "192.168.2.2" filename = filenodeitem.getattribute("upperip") filenodeitem.setattribute "upperip", "192.168.2.9" next next set objnodelist = xmldoc.getelementsbytagname("extradata") each comnodeitem in objnodelist 'jobname = comnodeitem.getattribute("name") each filenodeitem in comnodeitem.childnodes filename = filenodeitem.getattribute("extradataitem name") comnodeitem.createattribute "hostonly/virtualbox host-only ethernet adapter/ipaddress" filename = filenodeitem.getattribute("value") filenodeitem.setattribute "value", "192.168.2.1" next next xmldoc.save(file1) 
file says do not edit file.
if need programmatically modify virtualbox configuration, use appropriate tools:
vboxmanage setextradata global "hostonly/virtualbox host-only ethernet adapter/ipaddress" "192.168.2.1"
Comments
Post a Comment