Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: How can I do a WMI Bulk data retrieval ?

HTVi
TV Discussion Newsgroups

How can I do a WMI Bulk data retrieval ?
SherTeks 11/20/2008 10:08:05 AM
Hi,

The following WMI query executes fine and outputs the Processor details

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

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
Re: How can I do a WMI Bulk data retrieval ?
"Pegasus \(MVP\)" <I.can[ at ]fly.com.oz> 11/20/2008 10:41:25 AM

"SherTeks" <SherTeks[ at ]discussions.microsoft.com> wrote in message
news:6D254F68-839B-4F91-89A9-5C4C4AF9FA0C[ at ]microsoft.com...
[Quoted Text]
> Hi,
>
> The following WMI query executes fine and outputs the Processor details
>
> 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
>
> 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

Maybe I'm missin the point in your question but why don't you simply
continue along the same lines in your code?

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\.\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

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

For Each objItem In colBIOS
WScript.Echo "BIOS Manufacturer: " & objItem.Manufacturer
WScript.Echo "BIOS Details:"
For i = 0 To UBound(objItem.BIOSVersion)
WScript.Echo " " & objItem.BIOSVersion(i)
Next
Next


Re: How can I do a WMI Bulk data retrieval ?
SherTeks 11/20/2008 12:06:05 PM


"Pegasus (MVP)" wrote:

[Quoted Text]
>
> "SherTeks" <SherTeks[ at ]discussions.microsoft.com> wrote in message
> news:6D254F68-839B-4F91-89A9-5C4C4AF9FA0C[ at ]microsoft.com...
> > Hi,
> >
> > The following WMI query executes fine and outputs the Processor details
> >
> > 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
> >
> > 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
>
> Maybe I'm missin the point in your question but why don't you simply
> continue along the same lines in your code?
>
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\.\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
>
> Set colBIOS = objWMIService.ExecQuery _
> ("Select * from Win32_BIOS")
>
> For Each objItem In colBIOS
> WScript.Echo "BIOS Manufacturer: " & objItem.Manufacturer
> WScript.Echo "BIOS Details:"
> For i = 0 To UBound(objItem.BIOSVersion)
> WScript.Echo " " & objItem.BIOSVersion(i)
> Next
> Next
>
>
> Hi,

Thanks for the reply.
Yes, I knew this could be done.
But, I was looking for some other way (or some other WMI query) which would
actually package more than one queries ie. no more multiple ExecQuery(..) or
For loops.

May be some WMI query which works like snmpbulkget command which actually
gets all available details and the required details could be later parsed.

Thanks again.
Re: How can I do a WMI Bulk data retrieval ?
"Pegasus \(MVP\)" <I.can[ at ]fly.com.oz> 11/20/2008 12:55:45 PM

"SherTeks" <SherTeks[ at ]discussions.microsoft.com> wrote in message
news:24440D9D-CB44-4BAB-8E16-24D402FF3E9F[ at ]microsoft.com...
[Quoted Text]
>
>
> "Pegasus (MVP)" wrote:
>
>>
>> "SherTeks" <SherTeks[ at ]discussions.microsoft.com> wrote in message
>> news:6D254F68-839B-4F91-89A9-5C4C4AF9FA0C[ at ]microsoft.com...
>> > Hi,
>> >
>> > The following WMI query executes fine and outputs the Processor details
>> >
>> > 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
>> >
>> > 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
>>
>> Maybe I'm missin the point in your question but why don't you simply
>> continue along the same lines in your code?
>>
>> Set objWMIService = GetObject("winmgmts:" _
>> & "{impersonationLevel=impersonate}!\\.\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
>>
>> Set colBIOS = objWMIService.ExecQuery _
>> ("Select * from Win32_BIOS")
>>
>> For Each objItem In colBIOS
>> WScript.Echo "BIOS Manufacturer: " & objItem.Manufacturer
>> WScript.Echo "BIOS Details:"
>> For i = 0 To UBound(objItem.BIOSVersion)
>> WScript.Echo " " & objItem.BIOSVersion(i)
>> Next
>> Next
>>
>>
>> Hi,
>
> Thanks for the reply.
> Yes, I knew this could be done.
> But, I was looking for some other way (or some other WMI query) which
> would
> actually package more than one queries ie. no more multiple ExecQuery(..)
> or
> For loops.
>
> May be some WMI query which works like snmpbulkget command which actually
> gets all available details and the required details could be later parsed.
>
> Thanks again.

It's very foggy today in the place where I live and maybe my brain is fogged
up too but I can't see the purpose of your efforts. What's wrong with first
dealing with the Win32_Processor details, perhaps storing them in a
temporary array, then moving on to the BIOS staff, again storing it in a
suitable place? The corresponding pseudo-code would look like so:

Get_Processor_Details
Get_BIOS_Details
Compile_output_report


Re: How can I do a WMI Bulk data retrieval ?
"Richard Mueller [MVP]" <rlmueller-nospam[ at ]ameritech.nospam.net> 11/20/2008 4:32:55 PM

"SherTeks" <SherTeks[ at ]discussions.microsoft.com> wrote in message
news:24440D9D-CB44-4BAB-8E16-24D402FF3E9F[ at ]microsoft.com...
[Quoted Text]
>
>
> "Pegasus (MVP)" wrote:
>
>>
>> "SherTeks" <SherTeks[ at ]discussions.microsoft.com> wrote in message
>> news:6D254F68-839B-4F91-89A9-5C4C4AF9FA0C[ at ]microsoft.com...
>> > Hi,
>> >
>> > The following WMI query executes fine and outputs the Processor details
>> >
>> > 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
>> >
>> > 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
>>
>> Maybe I'm missin the point in your question but why don't you simply
>> continue along the same lines in your code?
>>
>> Set objWMIService = GetObject("winmgmts:" _
>> & "{impersonationLevel=impersonate}!\\.\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
>>
>> Set colBIOS = objWMIService.ExecQuery _
>> ("Select * from Win32_BIOS")
>>
>> For Each objItem In colBIOS
>> WScript.Echo "BIOS Manufacturer: " & objItem.Manufacturer
>> WScript.Echo "BIOS Details:"
>> For i = 0 To UBound(objItem.BIOSVersion)
>> WScript.Echo " " & objItem.BIOSVersion(i)
>> Next
>> Next
>>
>>
>> Hi,
>
> Thanks for the reply.
> Yes, I knew this could be done.
> But, I was looking for some other way (or some other WMI query) which
> would
> actually package more than one queries ie. no more multiple ExecQuery(..)
> or
> For loops.
>
> May be some WMI query which works like snmpbulkget command which actually
> gets all available details and the required details could be later parsed.
>
> Thanks again.

There is no more efficient way to retrieve the information. I know of no way
to combine the queries.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


Re: How can I do a WMI Bulk data retrieval ?
SherTeks 11/21/2008 4:37:01 AM


"Richard Mueller [MVP]" wrote:

[Quoted Text]
>
> "SherTeks" <SherTeks[ at ]discussions.microsoft.com> wrote in message
> news:24440D9D-CB44-4BAB-8E16-24D402FF3E9F[ at ]microsoft.com...
> >
> >
> > "Pegasus (MVP)" wrote:
> >
> >>
> >> "SherTeks" <SherTeks[ at ]discussions.microsoft.com> wrote in message
> >> news:6D254F68-839B-4F91-89A9-5C4C4AF9FA0C[ at ]microsoft.com...
> >> > Hi,
> >> >
> >> > The following WMI query executes fine and outputs the Processor details
> >> >
> >> > 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
> >> >
> >> > 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
> >>
> >> Maybe I'm missin the point in your question but why don't you simply
> >> continue along the same lines in your code?
> >>
> >> Set objWMIService = GetObject("winmgmts:" _
> >> & "{impersonationLevel=impersonate}!\\.\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
> >>
> >> Set colBIOS = objWMIService.ExecQuery _
> >> ("Select * from Win32_BIOS")
> >>
> >> For Each objItem In colBIOS
> >> WScript.Echo "BIOS Manufacturer: " & objItem.Manufacturer
> >> WScript.Echo "BIOS Details:"
> >> For i = 0 To UBound(objItem.BIOSVersion)
> >> WScript.Echo " " & objItem.BIOSVersion(i)
> >> Next
> >> Next
> >>
> >>
> >> Hi,
> >
> > Thanks for the reply.
> > Yes, I knew this could be done.
> > But, I was looking for some other way (or some other WMI query) which
> > would
> > actually package more than one queries ie. no more multiple ExecQuery(..)
> > or
> > For loops.
> >
> > May be some WMI query which works like snmpbulkget command which actually
> > gets all available details and the required details could be later parsed.
> >
> > Thanks again.
>
> There is no more efficient way to retrieve the information. I know of no way
> to combine the queries.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
>

Thanks all for the replies

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen