Hello all--

After a few hours of playing around ... and many, many hours of
searching ... I am not able to find an answer to my problem -- so I'm
hoping that the bright minds here might be able to help.

I'm working on a project to monitor various components of our
enterprise network via WMI. Being that VBScript/ASP are my primary
programming skills these days, I was planning on writing an interface
in ASP that would write items to an Access or SQL database, and then a
VBScript process which could query the database and submit WMI lookups
against hosts and log the data returned.

I know how to do all of the pieces required except one -- making a WMI
query mechanism that is "generic" enough to handle any type of data I
might want to retrieve (or at least typical sets such as numeric,
string, boolean, etc.) The problem that I have, is that the values
must be called specifically depending on what the data is. So, for
instance, if I want to get the temperature out of the system I have to
specifically call the ".CurrentTemperature" property within the code.
For example....

strComputer = "localhost"

set wbemServices = GetObject("winmgmts:\\" & strComputer &
"\root\wmi")
set wbemObjectSet =
wbemServices.InstancesOf("MSAcpi_ThermalZoneTemperature")

For Each wbemObject In wbemObjectSet
WScript.Echo "InstanceName : " & wbemObject.InstanceName
WScript.Echo "Current Temperature: " &
wbemObject.CurrentTemperature
Next

This works great - but it's just not generic for the several hundred
types of queries I can imagine running. I can't define a variable of
"CurrentTemperature" and call it at the end of the wbemObject. - it
just doesn't work that way (nor did I expect it would). Therefore, I
need something generic. I want to be able to create an Access
database record which would simply define the object set
(MSAcpi_ThermalZoneTemperature) and the property within that set
(CurrentTemperature) to check, and then handle that with generic
variables which can then post the data to Access, analyze it for
violating a threshold, etc.

(Apologies if I don't have the lingo quite right - I haven't actually
"officially" been a programmer for over a decade)

Hopefully I've gotten my point across and you might understand where
I'm headed with this. I'd moat likely make the framework an
open-source project as a simple and easy-to use network monitoring
system.

Thanks in advance!

-Douglas Toombs

Re: "generic" code to retrieve any type of WMI info - possible in VBScript? by Viatcheslav

Viatcheslav
Mon Jul 19 01:43:38 CDT 2004

wbemObject.Properties_("CurrentTemperature")

is equivalent to

wbemObject.CurrentTemperature

//------------------------------------
Regards,
Vassiliev V. V.
http://www-sharp.com -
Scripting/HTA/.Net Framework IDE


"Doug Toombs" <doug@netarchitect.com> ???????/???????? ? ???????? ?????????:
news:6311e30e.0407181703.46cfd598@posting.google.com...
> Hello all--
>
> After a few hours of playing around ... and many, many hours of
> searching ... I am not able to find an answer to my problem -- so I'm
> hoping that the bright minds here might be able to help.
>
> I'm working on a project to monitor various components of our
> enterprise network via WMI. Being that VBScript/ASP are my primary
> programming skills these days, I was planning on writing an interface
> in ASP that would write items to an Access or SQL database, and then a
> VBScript process which could query the database and submit WMI lookups
> against hosts and log the data returned.
>
> I know how to do all of the pieces required except one -- making a WMI
> query mechanism that is "generic" enough to handle any type of data I
> might want to retrieve (or at least typical sets such as numeric,
> string, boolean, etc.) The problem that I have, is that the values
> must be called specifically depending on what the data is. So, for
> instance, if I want to get the temperature out of the system I have to
> specifically call the ".CurrentTemperature" property within the code.
> For example....
>
> strComputer = "localhost"
>
> set wbemServices = GetObject("winmgmts:\\" & strComputer &
> "\root\wmi")
> set wbemObjectSet =
> wbemServices.InstancesOf("MSAcpi_ThermalZoneTemperature")
>
> For Each wbemObject In wbemObjectSet
> WScript.Echo "InstanceName : " & wbemObject.InstanceName
> WScript.Echo "Current Temperature: " &
> wbemObject.CurrentTemperature
> Next
>
> This works great - but it's just not generic for the several hundred
> types of queries I can imagine running. I can't define a variable of
> "CurrentTemperature" and call it at the end of the wbemObject. - it
> just doesn't work that way (nor did I expect it would). Therefore, I
> need something generic. I want to be able to create an Access
> database record which would simply define the object set
> (MSAcpi_ThermalZoneTemperature) and the property within that set
> (CurrentTemperature) to check, and then handle that with generic
> variables which can then post the data to Access, analyze it for
> violating a threshold, etc.
>
> (Apologies if I don't have the lingo quite right - I haven't actually
> "officially" been a programmer for over a decade)
>
> Hopefully I've gotten my point across and you might understand where
> I'm headed with this. I'd moat likely make the framework an
> open-source project as a simple and easy-to use network monitoring
> system.
>
> Thanks in advance!
>
> -Douglas Toombs



Re: "generic" code to retrieve any type of WMI info - possible in VBScript? by penguin

penguin
Mon Jul 19 07:26:30 CDT 2004

I don't think that this is what you want, but it might be useful to you:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Error Resume Next
strComputer = "localhost"

set wbemServices = GetObject("winmgmts:\\" & strComputer & "\root\wmi")
set wbemObjectSet =
wbemServices.InstancesOf("MSAcpi_ThermalZoneTemperature")

For Each wbemObject In wbemObjectSet
For Each Property in wbemObject.Properties_
WScript.Echo Property.Name & " : " & Property
Next
WScript.Echo vbCRLF
Next
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Hope it helps! Somehow



"Doug Toombs" <doug@netarchitect.com> wrote in message
news:6311e30e.0407181703.46cfd598@posting.google.com...
> Hello all--
>
> After a few hours of playing around ... and many, many hours of
> searching ... I am not able to find an answer to my problem -- so I'm
> hoping that the bright minds here might be able to help.
>
> I'm working on a project to monitor various components of our
> enterprise network via WMI. Being that VBScript/ASP are my primary
> programming skills these days, I was planning on writing an interface
> in ASP that would write items to an Access or SQL database, and then a
> VBScript process which could query the database and submit WMI lookups
> against hosts and log the data returned.
>
> I know how to do all of the pieces required except one -- making a WMI
> query mechanism that is "generic" enough to handle any type of data I
> might want to retrieve (or at least typical sets such as numeric,
> string, boolean, etc.) The problem that I have, is that the values
> must be called specifically depending on what the data is. So, for
> instance, if I want to get the temperature out of the system I have to
> specifically call the ".CurrentTemperature" property within the code.
> For example....
>
> strComputer = "localhost"
>
> set wbemServices = GetObject("winmgmts:\\" & strComputer &
> "\root\wmi")
> set wbemObjectSet =
> wbemServices.InstancesOf("MSAcpi_ThermalZoneTemperature")
>
> For Each wbemObject In wbemObjectSet
> WScript.Echo "InstanceName : " & wbemObject.InstanceName
> WScript.Echo "Current Temperature: " &
> wbemObject.CurrentTemperature
> Next
>
> This works great - but it's just not generic for the several hundred
> types of queries I can imagine running. I can't define a variable of
> "CurrentTemperature" and call it at the end of the wbemObject. - it
> just doesn't work that way (nor did I expect it would). Therefore, I
> need something generic. I want to be able to create an Access
> database record which would simply define the object set
> (MSAcpi_ThermalZoneTemperature) and the property within that set
> (CurrentTemperature) to check, and then handle that with generic
> variables which can then post the data to Access, analyze it for
> violating a threshold, etc.
>
> (Apologies if I don't have the lingo quite right - I haven't actually
> "officially" been a programmer for over a decade)
>
> Hopefully I've gotten my point across and you might understand where
> I'm headed with this. I'd moat likely make the framework an
> open-source project as a simple and easy-to use network monitoring
> system.
>
> Thanks in advance!
>
> -Douglas Toombs