View Full Version : Windows 7 task scheduler

30-06-2011, 01:41 PM
I've been trying to become familiar with the Task Scheduler in Windows 7 (%windir%\system32\taskschd.msc) which appears much more complicated to use than the scheduler in Window XP. I've managed to get it to work, except for one particular feature. In the settings you can select "Run task as soon as possible after a scheduled task is missed". According to the help files, this means that if your computer happens to be off when the scheduled task should start to run, it will try to run that task soon after the computer is restarted. But I just can't get that feature to work. The task (simply running a .bat file) runs perfectly well when initiated manually or at a specified time when the computer is on. But if the task is missed because the computer is off, it never starts after the computer is rebooted.

I wonder if there's anyone out there more familiar with the Windows 7 Task Scheduler than I who might be able to suggest what's going on?

30-06-2011, 01:44 PM
Perhaps it waits for X-minutes of the system being idle?

30-06-2011, 01:57 PM
Yes, the scheduler is meant to wait 10 minutes after the computer has been restarted and then it should start the task.

But it doesn't!

30-06-2011, 02:44 PM
Just tried it, turned off the computer and after the scheduled time, the App didn't run, but it did run approx ten minutes after the Computer was restarted.

Have a look in the actions on the right, make sure the history is enabled, if it is have a look and see what it says, there may be a reason why it didn't run.

30-06-2011, 03:42 PM
Thanks wainuitech.

I suppose that gives me some confidence that I'll eventually sort it out!

But I've just tried it several more times. Different tasks (putting a message on the desktop, just opening notepad and running a batch file). All work when run manually or at a specific time so I must have my permissions right. The Task Scheduler service is running and automatically starts at boot. All tasks that have run appear in history, but no mention at all of the task unable to run when the machine is off and which should run 10mins after boot. Nothing I can see in the Windows event viewer.

I'm at a loss!

Any other ideas very welcome!!

30-06-2011, 11:30 PM
Weird. I tested it here with win7 and it did exactly what wainui's did.

The History showed a warning saying it had missed the schedule. Do you see this?

01-07-2011, 08:00 AM
No linw, there's nothing in the history informing me the schedule had been missed.

I've now tried it on a different computer with a different variety of Windows 7 (Ultimate instead of Professional) and I still get the same effect.

It MUST be one of my settings.

If either of you had the time or inclination it would be really great if you could export the task (the one that worked for you) to the .XML file and post the contents. Then I could go over each setting one by one and work out what's going on.

The only other thing that has occurred to me is that I have an audio player installed (Total Recorder) which incorporates its own scheduler. There may be a conflict between that and the Windows scheduler. So I'll remove Total Recorder and see what happens. Clutching at straws! But thanks for your help.

01-07-2011, 09:57 AM
I disabled mine not because of any complication but its just as easy to do it manually

01-07-2011, 10:02 AM
The one that I ran was only a exe file ( ccleaner to be exact), not a batch file, so maybe thats where the problem is ??

Haven't got time to do a batch file right now, got appointments, but I'll give it a go later today and post back the result.

kahawai chaser
01-07-2011, 10:31 AM
W7 task scheduler has a command line (http://technet.microsoft.com/en-us/library/cc748993.aspx), but you need somehow create or find a script to implement what you want as noted here (http://social.technet.microsoft.com/Forums/en/w7itprogeneral/thread/1556ded7-257a-43f6-bd14-70b42cbf8415) for a missed task.

01-07-2011, 10:39 AM
Thanks wainuitech - I've tried it with a .exe (notepad.exe), and other .exe applications, and still have the problem

Yes kahawai chaser, I found that thread yesterday and have created a task using the command line and a .xml file as suggested. It behaves just like the tasks I create manually and doesn't run the task later if the schedule is missed.

Thanks Peter q - I disabled the Total Recorder scheduler and still have the problem. I intend to completely remove Total Recorder later on today when I have a moment.

kahawai chaser
01-07-2011, 11:28 AM
This thread (http://social.technet.microsoft.com/Forums/en-US/winserverManagement/thread/19e19311-6594-4a10-a49a-7e7a11562117) might offer ideas, of which a task scheduler managed wrapper (http://taskscheduler.codeplex.com/) is used and from code project. (http://www.codeproject.com/KB/cs/tsnewlib.aspx)

01-07-2011, 02:38 PM
Sounds like theres a fault in the task schedular somewhere.

Just out of interest, after the computer reboots, go into the services, make sure the task scheduler is set to automatic.

Also in the Services / task scheduler, Dependencies Tab, make sure RPC is there.

Just following on from post #10 by Kahawai Chaser -- if you want a "cheats" way to make the files, theres always the free Batchrun (http://www.outertech.com/) ( bottom of page) just tied it here, and it ran the selected file (foobar) after missing the set time + 10 Minutes after being turned off.

BUT yours should also run other exe's as well. :confused:

01-07-2011, 03:20 PM
Here's my test.xml

<?xml version="1.0" encoding="UTF-16"?>
-<Task xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task" version="1.2"> -<RegistrationInfo> <Date>2011-06-30T22:53:54.3862783</Date> <Author>Godzilla\Lin</Author> </RegistrationInfo> -<Triggers> -<CalendarTrigger> <StartBoundary>2011-06-30T23:13:40</StartBoundary> <Enabled>true</Enabled> -<ScheduleByDay> <DaysInterval>1</DaysInterval> </ScheduleByDay> </CalendarTrigger> </Triggers> -<Principals> -<Principal id="Author"> <UserId>Godzilla\Lin</UserId> <LogonType>InteractiveToken</LogonType> <RunLevel>LeastPrivilege</RunLevel> </Principal> </Principals> -<Settings> <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries> <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries> <AllowHardTerminate>true</AllowHardTerminate> <StartWhenAvailable>true</StartWhenAvailable> <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> -<IdleSettings> <StopOnIdleEnd>true</StopOnIdleEnd> <RestartOnIdle>false</RestartOnIdle> </IdleSettings> <AllowStartOnDemand>true</AllowStartOnDemand> <Enabled>true</Enabled> <Hidden>false</Hidden> <RunOnlyIfIdle>false</RunOnlyIfIdle> <WakeToRun>false</WakeToRun> <ExecutionTimeLimit>P3D</ExecutionTimeLimit> <Priority>7</Priority> </Settings> -<Actions Context="Author"> -<Exec> <Command>C:\sched.bat</Command> </Exec> </Actions> </Task>

02-07-2011, 02:21 PM
Thanks very much linw for going to the trouble of sending the xml file; it is very interesting. I've yet to analyse it in detail but one significant point is that your trigger is at a specific time EVERY DAY (DaysInterval=1)

<Enabled>true</Enabled> -

Mine is not set to run every day - it's only set to run once at a specific time


When I change my task to be daily like yours, everything works ok. It tells me the task was missed and then runs it about 10mins after the computer is rebooted. But when "one time" is set in the edit trigger settings I have the problem of the missed task not running after reboot.

Obviously, the "one time" is taking precedence over the "Run task as soon as possible after a scheduled task is missed"

And - no - I haven't got the "if the task is not scheduled to run again delete it...." checked.

It seems strange to me that a one time, non repeating, schedule should not be retried if it didn't run for any reason. I wonder whether this is a bug or a Microsoft "by design" feature. What do you think?

02-07-2011, 10:41 PM
I guess it could be a design feature. Maybe the reasoning is that a one-off must be fired at the right time in case it is bad news to fire it at the wrong time? Who knows?

Anyway, looks like the difference in behaviour has been sorted.

03-07-2011, 01:14 PM
You can do all the above and simpler (by looking at your xml stuff above) by using nnCron Lite from here - http://www.nncron.ru/

03-07-2011, 01:27 PM
Thanks decibel, I may well try nncron in due course, but I've just started seeing whether I can create a "once only" task by setting up a repetitive task (once every month, say) and then expiring the task before it runs a second time. Then I should get the benefit of the "Run task as soon as possible after a scheduled task is missed" working which it appears not to do when a "once only" task is set up.

04-07-2011, 11:12 AM
nncron looks interesting, decibel. It has a long list of features but I was a bit disappointed that it doesn't seem to be able to make coffee!

05-07-2011, 07:57 PM
nncron looks interesting, decibel. It has a long list of features but I was a bit disappointed that it doesn't seem to be able to make coffee!

Agreed, but it can pop up a window at the right time telling you to go and make your own !!

06-07-2011, 12:23 PM
Agreed, but it can pop up a window at the right time telling you to go and make your own !!

Excellent point:D