Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: How to prevernt Task Scheduler from running overdue actions on resume

18 Jul 2014   #1
KumaraB

Windows 7 Home Premium 64bit.
 
 
Prevent Task Scheduler from running overdue actions upon resume

With the Task Scheduler, I've created a task to hibernate at 7pm. (Action: shutdown -h). It works fine.

However problem occurs if I manually hibernate earlier. Upon turning on the computer the next day, the computer resumes, then hibernates immediately!

I can't find any setting to prevent that from happening. Can someone help?


My System SpecsSystem Spec
.
18 Jul 2014   #2
Kari

Microsoft Community Contributor Award Recipient

 

Quote   Quote: Originally Posted by KumaraB View Post
With the Task Scheduler, I've created a task to hibernate at 7pm. (Action: shutdown -h). It works fine.

However problem occurs if I manually hibernate earlier. Upon turning on the computer the next day, the computer resumes, then hibernates immediately!

I can't find any setting to prevent that from happening. Can someone help?
Task Scheduler has a setting that should do exactly that, reset task if the scheduled time is missed, but as much as I have tried I have never get it to work.

In task settings you can find a setting Run task as soon as possible after a scheduled start is missed:
How to prevernt Task Scheduler from running overdue actions on resume-2014-07-18_12h09_20.png
Disabling it should do exactly what you want to, it should "reset" the task when the scheduled time is missed and only run it again at the next scheduled time. However, I have tried to get this working in a certain task, have had no luck; it seems this setting is totally ignored by Task Scheduler (at least in Windows 8.1 I'm using).

However, you could use an easy workaround. Do this:
  1. Allow task to be run on demand:
    How to prevernt Task Scheduler from running overdue actions on resume-2014-07-18_12h09_21.png
  2. Create a new shortcut to your desktop to run this command (replace Hibernate with the name of your task):
    Code:
    schtasks.exe /run /TN Hibernate
That's it. Now when you want to hibernate before the scheduled time do it by double clicking the shortcut you created instead of selecting Hibernate from Start Menu. The PC hibernates and task is marked to be run, your PC does no longer hibernate immediately when waked up after the scheduled time.

Kari


My System SpecsSystem Spec
19 Jul 2014   #3
KumaraB

Windows 7 Home Premium 64bit.
 
 

That's so very smart. Kiitos paljon!

Anyway, I did try the same thing you expected by disabling that setting. Wonder if MS would issue an update to correct that bug if we report it?
My System SpecsSystem Spec
.

19 Jul 2014   #4
Kari

Microsoft Community Contributor Award Recipient

 

You are welcome .

To run a task from command line is quite practical workaround, I use it myself always if a scheduled task needs sometimes to be run on demand. If you do it quite often then a shortcut which will run the task will do the trick.
My System SpecsSystem Spec
06 Aug 2014   #5
KumaraB

Windows 7 Home Premium 64bit.
 
 

This worked. Then, for some unknown reason, the problem returned!

Perhaps it's because I meddled with something. I don't get it. Any ideas?
My System SpecsSystem Spec
06 Aug 2014   #6
Kari

Microsoft Community Contributor Award Recipient

 

Quote   Quote: Originally Posted by KumaraB View Post
This worked. Then, for some unknown reason, the problem returned!

Perhaps it's because I meddled with something. I don't get it. Any ideas?
I really cannot understand what you mean with this? The workaround I told you in post #2 is always valid, works always.

Here's the workaround explained:
  1. When computer is shutdown or hibernated before your hibernation task is scheduled to run, and computer is again turned on or waked up first after this scheduled time, the task which has missed its scheduled time will run as soon as it can, meaning your computer will hibernate as soon as it has been turned on or waked up
  2. To avoid this you simply create a shortcut for your hibernation task and allow the task to be run on demand
  3. Now when you want to hibernate before your scheduled hibernation task is supposed to be run, you do it from the shortcut
  4. This marks the task to be run and it is no longer run when you power on or wake up the computer
It really is this simple, I cannot see how you could meddle with it?

Kari
My System SpecsSystem Spec
06 Aug 2014   #7
KumaraB

Windows 7 Home Premium 64bit.
 
 

Firstly, thanks for the response, Kari. I understand your explanation, I just didn't understand why Windows didn't do as expected. A possible good news is though is I now realise why it might have failed: I had the command line placed in a batch file because I wanted to run something before hibernation. Shall test just the shortcut and revert.
My System SpecsSystem Spec
07 Aug 2014   #8
KumaraB

Windows 7 Home Premium 64bit.
 
 

I confirm that using purely the shortcut works. I suppose what I did was wrong because the batch file works within a command shell, thus a separate process. Now, to fulfil my preference, I have the task action set as the batch file instead. Should be okay now. Thanks.
My System SpecsSystem Spec
11 Aug 2014   #9
KumaraB

Windows 7 Home Premium 64bit.
 
 

Just like to add that what I want, i.e. run a batch file where various processes are run before hibernation, is a bit more complicated. To cut the story short, here's what works:
1. Create a batch file which includes various processes including shutdown -h, and put it wherever you want. (I name it "Execute Hibernation Sequence.bat".)
2. Create scheduled task (with the triggers you want) pointing to that batch file. (I name it "Execute Hibernation Sequence".)
3. On the desktop, create a shortcut for the scheduled task: schtasks.exe /run /TN "Execute Hibernation Sequence". (You need to name the last part according to the name you give the scheduled task.)
My System SpecsSystem Spec
Reply

 How to prevernt Task Scheduler from running overdue actions on resume




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Task Scheduler not running??
Hello- Anyone getting this message or had it and corrected it? see attachment. I''ve been on Google for a loong time and not really finding a fix. HP system 3 weeks old and this seems to be a problem for a ton of people. I check the services and its running and grayed out so I can't touch...
Performance & Maintenance
Task scheduler not running??????
My daughter has an HP laptop that she uses in nursing school. It started acting funny and I found a bunch of junk on the computer that she says she doesn't know where it came from. But me problem is that automatic updates has stopped working along with the disk defag. When I try to run the...
General Discussion
Task Scheduler not Running Tasks
I created two tasks (Utorrent and Flashget) to run at 12:15 am every night but the tasks refuse to startup. I usually hibernate my computer at night so i have the two tasks "wake computer up to run this task" (the computer does wake itself up) The only way i can get it to run is if i manually run...
General Discussion
Task Scheduler not running
I can't install anything on my computer or run disk defragger because I keep getting error messages. Here is one: "Disk Deragmenter cannot start because the task scheduler service is not running. Start the task scheduler service and try again. I tried to mess around with the task scheduler...
General Discussion
task scheduler not running missed task
When i set task scheduler to run a program it works. But if the pc is not on at the time it will not run unless task scheduler is opened. It is set to run as soon as poss after scheduled time and task scheduler itself starts and runs properly
General Discussion
Task Scheduler & Running application in foreground....
Hi, My requirement is to start an application (UI based) in the foreground as soon as the PC boots (whether user is logged in or not). I added a task to the task scheduler & configured it to run under the same account as my foreground logon account. I am seeing the task is scheduled but it...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 09:02.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App