How can I do a WMI Bulk data retrieval ?

Joined
Nov 20, 2008
Messages
1
Reaction score
0
Hi,

The following WMI query executes fine and outputs the Processor details

Code:
On Error Resume Next
 
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
	& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
 
For Each objItem in colItems
	Wscript.Echo "Address Width: " & objItem.AddressWidth
	Wscript.Echo "Architecture: " & objItem.Architecture
	Wscript.Echo "Availability: " & objItem.Availability
	Wscript.Echo "CPU Status: " & objItem.CpuStatus
Next
Now, I also want to execute the below query

Code:
Set colBIOS = objWMIService.ExecQuery _
	("Select * from Win32_BIOS")
which would get BIOS details.

But, how can I execute both the query in one fell swoop ie. in a bulk.

Note : There is some snmp (protocol) command called snmpbulkget that actually fetches bulk data from a network entiry
with one command. Is there anything similar to this in WMI that fetches bulk data.

Thanks in Advance
 
Joined
Apr 17, 2009
Messages
8
Reaction score
0
On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")

For Each objItem in colItems
Wscript.Echo "Address Width: " & objItem.AddressWidth
Wscript.Echo "Architecture: " & objItem.Architecture
Wscript.Echo "Availability: " & objItem.Availability
Wscript.Echo "CPU Status: " & objItem.CpuStatus
Next

For Each objItem in colBIOS
Wscript.Echo "Address Width: " & objItem.Caption
Wscript.Echo "Architecture: " & objItem.Description
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top