Slayer
2007-10-23 09:28:01 UTC
Hi, Please Help !
I am trying to write a script that loads some counter details from a SQL
table, executes a WMI query and then writes the results back to a SQL table.
The script will loop through the counters that it loads. My problem is I run
my WMI query
set colsettings = objWMIService.ExecQuery("SELECT PercentProcessorTime FROM
Win32_PerFormattedData_PerfOS_Processor where name = '_Total'). The actual
query contains references to the recordsets returned from SQL server
containing the counter details. For example "PercentProcessorTime" above is
replaced with objCounterRecordSet.Fields.Item("WMIProperty") and also the WMI
Class is replaced with a reference to the recordeset.
I now have one element in the reurned collection which I have to loop
through. For testing I am only trying to retrieve the value.
For each objItem in colsettings
wscript.echo objitem.PercentProcessorTime
Next.
The problem is I have several counters in my SQL table and am looping
through them so I need to replace "PercentProcessorTime" above with which
ever WMIClass parameter I happen to be working with and I cannot get this to
work. I guess what I am trying to do is use the value in a recordset as a
property for an object.
Anybody got any ideas or am i trying to do something that cannot be achieved.
I am trying to write a script that loads some counter details from a SQL
table, executes a WMI query and then writes the results back to a SQL table.
The script will loop through the counters that it loads. My problem is I run
my WMI query
set colsettings = objWMIService.ExecQuery("SELECT PercentProcessorTime FROM
Win32_PerFormattedData_PerfOS_Processor where name = '_Total'). The actual
query contains references to the recordsets returned from SQL server
containing the counter details. For example "PercentProcessorTime" above is
replaced with objCounterRecordSet.Fields.Item("WMIProperty") and also the WMI
Class is replaced with a reference to the recordeset.
I now have one element in the reurned collection which I have to loop
through. For testing I am only trying to retrieve the value.
For each objItem in colsettings
wscript.echo objitem.PercentProcessorTime
Next.
The problem is I have several counters in my SQL table and am looping
through them so I need to replace "PercentProcessorTime" above with which
ever WMIClass parameter I happen to be working with and I cannot get this to
work. I guess what I am trying to do is use the value in a recordset as a
property for an object.
Anybody got any ideas or am i trying to do something that cannot be achieved.