WMI CPU Script - Load % Not Correct - please help.

Hi, I have a CPU script in WMI/Vbscript and works on most machines, WINNT, 2000 and 2003.

But on one machine, it constantly reports the load at 98%, and this is simply NOT correct.  Any ideas why this would happen?  I runs it local and remotely, and get the same value.  On the box's task manager and perfmon, the load is COMPLETLEY NORMAL, ie 1-10%?

SCRIPT AT BOTTOM:

Also,
1) If I am querying multiple servers, is there any way to speed performance?
2) Does executing this WMI script anyway affect/impact the targe server? Performance wise,etc.
3) Currently, the WMI script I have posted will iterate for ALL processors on a server, is there a WMI script that will just get the total average CPU?  I know I can iterate through all cpus and then do the math, but I thought if there was a way to get the total cpu load %, it would enhance performance.

Any ideas on how to accomplish the above?  Or API alternatives?  Many thanks!


------------------------------
Computer = "mybox"
Set WshNtwk = WScript.CreateObject("WScript.Network")
Set ProcSet = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2").InstancesOf ("Win32_Processor")
checkedCPU = WshNtwk.ComputerName


Wscript.echo "Computer Name =" & Computer
for each System in ProcSet
Wscript.echo "Load % =" & system.LoadPercentage
Wscript.echo "CPUdevice=" & system.deviceid
next
rsp05Asked:
Who is Participating?
 
grayeConnect With a Mentor Commented:
Humm... you're right... it's not likely that a simple WMI script would cause that much of a spike.

Here is another suggestion (althought it might be kinda wild).   You could dump the WMI repository on that server, and have it recreate the repository from scratch on the next reboot.   Sometimes that helps...    We've had problems with corrupted WMI repository before when we renamed a bunch of servers... rebuilding the repository fixed it.

instructions are at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/reinstalling_wmi.asp
0
 
gecko_au2003Commented:
Go here :

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwmi/html/mngwmi.asp

If you scroll down a bit on that page , it has an example for detecting high cpu load and you can obviously alter it to your needs :)
0
 
grayeCommented:
Hummm... I'd consider another point of view....

If that's the only PC that's got a problem, then I'd be asking questions about that PC.

How many CPUs (to include whether hyperthreading is turned on)
RAM
Running Processes

It could be that the "affect" of running the script alone could be enough to push up the %load
0
 
rsp05Author Commented:
thx for replies.  graye: I think it has 4cpus, and all processors return 98%.  Can this one script really cause a spike on all 4 processors?  It doesn't seem to affect ANY other server in this way.  Again, the taskmgr shows low cpu, at the same time I run script.

Any other ideas?  Thx, much!
0
 
rsp05Author Commented:
dear graye:  BINGO!  But not exactly the way you suggested.  Maybe even a DOH!  I was going to reinstall, when I just thought, maybe if I restart the services, I would refresh it.  And walla!  It worked!
I will now AWARD you the points for putting the thought of the services in my head  ;-)

MAny THanks!

Regards!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.