K
ketan
Hi,
I have Written a WMI query in VBScript which gets BIOS info. Now, I would
like to output only some specific properties to an XML file. Can someone
please tell me how to go about this? I am not very familiar with VBScript.
I know how to output all the properties of a class to XML. But am looking to
query and output only certain properties i am interested in. I have the code
as follows:
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
set context = CreateObject("Wbemscripting.SWbemNamedValueSet")
context.add "PathLevel", 2
context.add "IncludeQualifiers", true
context.add "ExcludeSystemProperties", true
set myObj = GetObject("winmgmts:\\[sysname]\root\cimv2:Win32_BIOS")
Set colItems = myObj.ExecQuery("SELECT Manufacturer FROM Win32_BIOS",
"WQL",wbemFlagReturnImmediately + wbemFlagForwardOnly) /********If i dont
write this query but output the entire win32_bios class, i get the xml file
***/
For Each objItem In colItems
strText =objItem.GetText_(2,,context)
Next
set xml = CreateObject("Microsoft.xmldom")
xml.async = false
xml.loadxml strText
xml.save"C:\text.xml"
wscript.echo xml.xml /******I am not getting any value in the output
**********/
I have Written a WMI query in VBScript which gets BIOS info. Now, I would
like to output only some specific properties to an XML file. Can someone
please tell me how to go about this? I am not very familiar with VBScript.
I know how to output all the properties of a class to XML. But am looking to
query and output only certain properties i am interested in. I have the code
as follows:
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
set context = CreateObject("Wbemscripting.SWbemNamedValueSet")
context.add "PathLevel", 2
context.add "IncludeQualifiers", true
context.add "ExcludeSystemProperties", true
set myObj = GetObject("winmgmts:\\[sysname]\root\cimv2:Win32_BIOS")
Set colItems = myObj.ExecQuery("SELECT Manufacturer FROM Win32_BIOS",
"WQL",wbemFlagReturnImmediately + wbemFlagForwardOnly) /********If i dont
write this query but output the entire win32_bios class, i get the xml file
***/
For Each objItem In colItems
strText =objItem.GetText_(2,,context)
Next
set xml = CreateObject("Microsoft.xmldom")
xml.async = false
xml.loadxml strText
xml.save"C:\text.xml"
wscript.echo xml.xml /******I am not getting any value in the output
**********/