Possibly among the most obscure things this BBS has ever been asked. But other really strange stuff has gotten answers on this BBS, so I'm trying.

If you want to write a script to monitor performance variables on your Windows computer, you do it by querying WMI. There are two ways of doing this. One is to directly write a single query to the WMI object. You can retry that query multiple times with different parameters if you want, to get other types of data. The other way is to set up what's called a "refresher" object, and then query the values within it. Then when you want new information, instead of instantiating a new object for the new query, you just call objRefresher.Refresh and look at the values again.

Everything I've read on the 'net says that I should be able to use either method, and that both methods should work fine on both Vista and on Server 2003.

Both methods work great for me on Vista, but on half a dozen Server2003 boxes I've tried it on, I get strange results with the "Refresh" version of the query. The strange results are: The query works, and returns data, but all of the data fields are NULL except for the "Name" field (which is always right).

Here is my stripped-down sample code. Save this code as a ".VBS" file on your hard disk and double click on it:

Code:
moved to an attachment


Anyone know what's up with this?


Attachments
tonyscode.vbs (111 downloads)



Edited by wfaulk (19/12/2009 01:20)
Edit Reason: moved code to attachment
_________________________
Tony Fabris