Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

hi I have a problem oposite to the usual one.

I have a task to hibernate my computer at 8pm If I hibernate the computer earlier, and turn it on next morning, the task runs and hibernates the computer (what I dont wont to happen)

I HAVE NOT selectede the "Run task as soon as posible after a schedule start is missed"

Am I wrong? doesn't this means that if the task is messed, it´s not going to run ?

Alex

share|improve this question

migrated from serverfault.com Aug 1 '10 at 22:53

This question came from our site for system and network administrators.

2 Answers 2

If you hibernate the computer before the time that the task is scheduled to start then the current clock state is saved as well (for synchronisation purposes).

Once you resume from hibernation, the OS clock is brought back into sync with the hardware clock (which now shows a time and date that is after the scheduled task). I can only think that perhaps this triggers scheduled tasks to run because the time doesn't skip straight from A to B but rather 'plays forward' the interval in-between.

share|improve this answer
    
If this is the problem it might be as simple as setting the task to only run after X minutes of the machine being idle? Just a guess, the task scheduler for me in all versions of Windows never plays nicely. –  Richard Aug 10 '10 at 12:02
    
Yes, that could be a solution, but what I really want is the PC to start at 8:45 (this works via the BIOS) and shutdown at 8:00 pm, because sometimes I don't even go to the office but I access the PC remotely. About the hardware clock sync, even so, it should work... probably is a Task scheduler misbehavior. I deleted the task and create a new one, but happens exactly the same. –  Alex Angelico Aug 12 '10 at 20:24

I was having the similar problem. (My task was set to run at 5:30 PM and then wait for 15 minutes of inactivity before suspending.)  In my case, it would work fine so long as the computer was running at 5:30 PM every day. If it ever missed the task due to being suspended, it would run the task on resume (and yes, I had also unchecked "Run task as soon as possible after a scheduled start is missed"). It would then suspend the computer after being resumed and having 15 minutes of inactivity.

So, here's my solution:

  1. Edit your task's trigger. Check "Delay task for up to:" and select "1 minute"
  2. Create a batch file named "kill.bat"

    @echo off
    timeout 10
    schtasks /end /tn TaskName           # (Replace TaskName with the name of your task.)
    

    You may have to tinker with the timeout number. What you're looking for is for some amount of time (in seconds) that falls between a) the time required for the OS's clock to synchronise after resume, and b) the amount of time you delayed your task to run. Setting this number can get squirrelly given that the delay time is a maximum amount and not a specific amount. Try to set this timeout as close as possible to the time needed for the OS's clock to synchronize.

  3. Create a second task – this task will run the batch file you just created upon system resume.

    Trigger:
        Begin the task: "On an event"
        Log: System
        Source: Power-Troubleshooter
        Event ID: 1
    Action:
        Select the batch file you created in step 2.
    

    When configured properly, this new task should run on resume and kill the original task during the 1 minute delay you added to its configuration.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.