PC Review


Reply
Thread Tools Rate Thread

writing to XML file using WMI in VBScript -windows 2003 server

 
 
ketan
Guest
Posts: n/a
 
      18th Nov 2008

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
**********/

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing remote computer using WMI & vbscript f.b.ayub Webmaster / Programming 0 26th Sep 2007 08:03 AM
what encoding does system.xml.xmldocument.save(string path) use to save the xml document if there is no <?xml... in the front of the xml document? Daniel Microsoft C# .NET 7 17th Mar 2007 11:29 AM
what encoding does system.xml.xmldocument.save(string path) use to save the xml document if there is no <?xml... in the front of the xml document? Daniel Microsoft Dot NET Framework 5 17th Mar 2007 10:11 AM
what encoding does system.xml.xmldocument.save(string path) use to save the xml document if there is no <?xml... in the front of the xml document? Daniel Microsoft Dot NET 1 15th Mar 2007 10:37 AM
.NET & WMI & SNMP -> Writing Values to WMI Spam Catcher Microsoft VB .NET 0 17th Dec 2006 09:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:54 AM.