|
-
November 20th, 2008, 04:13 AM
#1
How can I do a WMI Bulk data retrieval ?
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
-
November 20th, 2008, 08:55 AM
#2
Re: How can I do a WMI Bulk data retrieval ?
I haven't used WMI in a long time, but can you concatenate your queries? For example:
Code:
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor; Select * from Win32_BIOS")
EDIT - Nope - scratch that idea. I think the problem you're going to run into by doing this is the namespaces will collide - For example, the Processor namespace and the BIOS namespace could both have a Name object. You may just have to run multiple queries.
Last edited by mmetzger; November 20th, 2008 at 09:14 AM.
-
November 21st, 2008, 04:32 PM
#3
Re: How can I do a WMI Bulk data retrieval ?
Just to confirm this...
Yes, you are going to have to run two separate queries.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|