I’ve just run it in Windows 7 on my lappy and it did the 5 hits and then fell over
The next time I ran it, it did more than 5 hits before it fell over. Not sure what output you were expecting, but it definitely is hitting a snag at the else point. Other than that, the system is reporting when below threshhold, but falls over when above. Do you have to specify an upper and lower limit?
[QUOTE=Droid;466093]I’ve just run it in Windows 7 on my lappy and it did the 5 hits and then fell over
The next time I ran it, it did more than 5 hits before it fell over. Not sure what output you were expecting, but it definitely is hitting a snag at the else point. Other than that, the system is reporting when below threshhold, but falls over when above. Do you have to specify an upper and lower limit?
Not to up on shell, but if you need anyone to test, let me know.[/QUOTE]
hi Droid,
the error your getting is due to the threshold for cpu not being hit. if copy that script into notepad and save as a *.ps1 file and run it you will find it behaves better…
to test the over threshold change line 2 $cpu_threshold = 85 to $cpu_threshold = 1
you will get an error at the point it calls the batch file but thats to be expected as you don’t have the batch file.
Do you only want it as a continuous monitor and only to report when over the threshold and send the e-mail alert, if so, do you need the Else part anyway? If it’s all below the CPU load you don’t need the system to report anything and you can just it leave it running and only stop when the CPU goes over the threshold.
i will give that a go. the reason i needed it was something was causing the explorer.exe process to use 100% cpu and i couldn’t identify what it was exactly. I was looking at this last night and it turned out to be my antivirus so a few carefully placed exceptions and that should be sorted now.