none
Can't get task schedular to run a batch on idle.

    Question

  • Hello,

    This may sound odd but I have a client who wants automatic reboot when his computer is idle for 10 minutes.   I got this working in XP no problem (he has 2 PCs).    I tried to do the same thing with a task in Windows 7 and couldn't get it to work.   If I run the batch file manually or even force it to run from task schedular in Windows 7 it runs fine.   There are two places for triggers in Windows 7 to set on idle.   I've tried them both.   I'm not sure if I set the on idle settings wrong or if I need to do something to make the computer think it is idle in Windows 7.   I set it for 1 minute for testing and left the computer alone for 2 minutes and it still didn't trigger.   If I do the same with XP it reboots.  

    I'm sure it is an easy thing to do but I can't figure out what I'm doing wrong so if someone could help out someone with a newbie question I would appreciate your assistance.

    Thanks
    Saturday, November 21, 2009 1:05 PM

Answers

  • Ok, so what are the settings on the "condition" page? Do you have the first option to 10 minutes and the other one to "Do not wait"?

    I found the following information which could be useful, found in the help files:

    Idle Conditions

    You can set a condition that tells the task to run only if the computer is in an idle state for a specific amount of time when a trigger is activated. When you set this condition, you also set the amount of time to wait (after the task is triggered) for the computer to enter an idle state.

    The Task Scheduler service will check if the computer is in an idle state every 15 minutes. A computer is considered to be in an idle state when a screen saver is running. If a screen saver is not running, then the computer is considered to be in an idle state if there is 0% CPU usage and 0% disk input or output for 90% of the past fifteen minutes and if there is no keyboard or mouse input during this period of time. Once the Task Scheduler service detects that the computer is in an idle state, the service only waits for user input to mark the end of the idle state.

    If a task is set to start only if the computer is idle for 30 minutes, and the task waits for the computer to be idle for 10 minutes, then the task will launch in 5 minutes only if the computer has been idle for 25 minutes prior to the time the trigger was activated. The task will not start if the computer enters an idle state 5 minutes after the trigger is activated.

    If the Stop if the computer ceases to be idle condition is selected for a task and the task is running while the computer is in an idle state, then the task will stop running when the computer ceases to be idle. The task that is stopped by this condition will start running again the next time the computer enters an idle state if the Restart if idle state resumes condition is selected.

    Saturday, November 21, 2009 3:18 PM

All replies

  • You might have to make sure that it is running with the highest priviliges, see the General tab on the scheduled task and see if "Run with highest priviliges" is checked.
    Saturday, November 21, 2009 2:03 PM
  • Thanks - I should have mentioned that I did try that and it doesn't work.   The user that is logged in is an administrator on the workstation and it is not a member of a domain.
    Saturday, November 21, 2009 2:54 PM
  • Ok, so what are the settings on the "condition" page? Do you have the first option to 10 minutes and the other one to "Do not wait"?

    I found the following information which could be useful, found in the help files:

    Idle Conditions

    You can set a condition that tells the task to run only if the computer is in an idle state for a specific amount of time when a trigger is activated. When you set this condition, you also set the amount of time to wait (after the task is triggered) for the computer to enter an idle state.

    The Task Scheduler service will check if the computer is in an idle state every 15 minutes. A computer is considered to be in an idle state when a screen saver is running. If a screen saver is not running, then the computer is considered to be in an idle state if there is 0% CPU usage and 0% disk input or output for 90% of the past fifteen minutes and if there is no keyboard or mouse input during this period of time. Once the Task Scheduler service detects that the computer is in an idle state, the service only waits for user input to mark the end of the idle state.

    If a task is set to start only if the computer is idle for 30 minutes, and the task waits for the computer to be idle for 10 minutes, then the task will launch in 5 minutes only if the computer has been idle for 25 minutes prior to the time the trigger was activated. The task will not start if the computer enters an idle state 5 minutes after the trigger is activated.

    If the Stop if the computer ceases to be idle condition is selected for a task and the task is running while the computer is in an idle state, then the task will stop running when the computer ceases to be idle. The task that is stopped by this condition will start running again the next time the computer enters an idle state if the Restart if idle state resumes condition is selected.

    Saturday, November 21, 2009 3:18 PM
  • Thanks for your help.   I'll let you know what settings I have in case it makes it easier for you to figure out what I messed up.

    batch file - logoffuser.bat   - shutdown /f /r /t 60  - which runs fine when you run it manually by clicking on it or from task schedular when you force it to run

    Task schedular
    create task
    set to run only when that user is logged on - they have other users who use that computer but don't want it to run for everyone.   The user logged on is an adminstator on that PC.
    set to highest

    I tried setting the trigger on idle (also tried it without that trigger)

    The action is the batch file

    The conditions I set are
    set to run on idle for 1 minute
    Do not wait
    stop if PC ceases to be idle.

    It is on a PC so it always has power

    Saturday, November 21, 2009 4:51 PM
  • Did you get this to work OK?
    Monday, November 23, 2009 7:26 PM
  • Thanks for checking.   I think it is working but taking longer to go to idle than the time I specify in task manager.   I'll be able to check next week when I go back to that client.
    Monday, November 23, 2009 9:37 PM