|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How can I do a WMI Bulk data retrieval ?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
Show quote
Hide quote
"SherTeks" <SherT***@discussions.microsoft.com> wrote in message Maybe I'm missin the point in your question but why don't you simply news:6D254F68-839B-4F91-89A9-5C4C4AF9FA0C@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 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
Show quote
Hide quote
"Pegasus (MVP)" wrote: Thanks for the reply.> > "SherTeks" <SherT***@discussions.microsoft.com> wrote in message > news:6D254F68-839B-4F91-89A9-5C4C4AF9FA0C@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, 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.
Show quote
Hide quote
"SherTeks" <SherT***@discussions.microsoft.com> wrote in message It's very foggy today in the place where I live and maybe my brain is fogged news:24440D9D-CB44-4BAB-8E16-24D402FF3E9F@microsoft.com... > > > "Pegasus (MVP)" wrote: > >> >> "SherTeks" <SherT***@discussions.microsoft.com> wrote in message >> news:6D254F68-839B-4F91-89A9-5C4C4AF9FA0C@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. 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
Show quote
Hide quote
"SherTeks" <SherT***@discussions.microsoft.com> wrote in message There is no more efficient way to retrieve the information. I know of no way news:24440D9D-CB44-4BAB-8E16-24D402FF3E9F@microsoft.com... > > > "Pegasus (MVP)" wrote: > >> >> "SherTeks" <SherT***@discussions.microsoft.com> wrote in message >> news:6D254F68-839B-4F91-89A9-5C4C4AF9FA0C@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. to combine the queries.
Show quote
Hide quote
"Richard Mueller [MVP]" wrote: Thanks all for the replies> > "SherTeks" <SherT***@discussions.microsoft.com> wrote in message > news:24440D9D-CB44-4BAB-8E16-24D402FF3E9F@microsoft.com... > > > > > > "Pegasus (MVP)" wrote: > > > >> > >> "SherTeks" <SherT***@discussions.microsoft.com> wrote in message > >> news:6D254F68-839B-4F91-89A9-5C4C4AF9FA0C@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 > -- > > >
What is error '80041003', please?
Command Script variable value lost during execution querying wmi - recommended structure when iteration seems unnecessary? accesschk script to include datestamp Simple Ping Script managing NTFS permissions - cacls or wmi? How to create a unique samaccountname in AD chech group User on the system Start up Script to add username,computername and IP address on every printed pages |
|||||||||||||||||||||||