Quote:

Question... does the running of this script affect the idleness ?




Yes of course to a small degree.

It is very low for reasonable intervals, and even when I had the interval as low as 3 seconds during testing the idle time was never below 100% when nothing else was running. For longer periods it will have less impact.

To test it, set the interval period to a 1 second, start task manager to monitor what it thinks CPU usage is and then start a process - I used "dir /s" in the root directory.

You will see that the values of idle time from the script and CPU time in task manager are pretty close.

If the script is going to be called by a scheduled task then the "last" values need to be stored in and recalled from the registry or a file, and a sanity check needs to be made to reset the values if the process is not run for some time, the machine is restarted or the counters wrap.