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