2

I have a number of scheduled tasks that run daily. According to their schedule times, they should run as soon as Windows boots first thing in the morning. However, the tasks don't run until 10 minutes after Windows boots. One example is a task scheduled to run at 12:00am. If I shut down PC at 11:30pm, the task should run as soon as Windows finishes booting at 8:00am next morning.

All of my tasks eventually run, but something is causing them to delay by as much as 10 minutes. I'd like them to run as soon as Windows boots.

Per comment, posting the config XML for the task:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2016-12-04T15:46:45.9954241</Date>
    <Author>redacted-PC\redacted</Author>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <Repetition>
        <Interval>PT12H</Interval>
        <Duration>P1D</Duration>
        <StopAtDurationEnd>false</StopAtDurationEnd>
      </Repetition>
      <StartBoundary>2016-12-04T00:00:00</StartBoundary>
      <Enabled>true</Enabled>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>redacted-PC\redacted</UserId>
      <LogonType>Password</LogonType>
      <RunLevel>HighestAvailable</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>true</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>"C:\Program Files\redacted\redacted.exe"</Command>
      <WorkingDirectory>C:\Program Files\redacted</WorkingDirectory>
    </Exec>
  </Actions>
</Task>
6
  • Can you export the config of one of these tasks to XML and link to it, maybe use Pastebin. You can do this from Task Scheduler. Thanks Oct 5, 2019 at 12:43
  • @HelpingHand Updated question Oct 5, 2019 at 13:42
  • Thx, I was most interested to check RunOnlyIfIdle but that is false. That said, looking at: docs.microsoft.com/en-us/windows/win32/taskschd/… it seems for the StartWhenAvailable property of the task the default delay is 10 minutes which fits with your analysis. Oct 5, 2019 at 18:05
  • 3
    I believe I have found the key you need under: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\Configuration There is MissedTasksStartupDelay which by default, as mentioned is 10 minutes or 600 seconds as it's set in the registry. You should be able to change this registry value to say 60? Restart the computer so the Scheduler service can read it at startup. Oct 5, 2019 at 18:36
  • @HelpingHand Good sleuthing. I changed it to 30, rebooted, and the tasks all ran nearly immediately. I am going to see what happens tomorrow morning after a setting of 0, but I believe you can post this as answer for some easy points. Oct 6, 2019 at 16:28

1 Answer 1

4

When configuring a scheduled task in Windows, one of the 'Settings' is labeled in the Task Scheduler UI as:

Run task as soon as possible after a scheduled start is missed

enter image description here

When exporting the configuration of the task to XML, this same setting is defined as:

StartWhenAvailable

enter image description here

The Microsoft documentation for this property says:

Tasks that are started after the scheduled time has passed (because of the StartWhenAvailable property being set to True) are queued in the Task Scheduler service's queue of tasks and they are started after a delay. The default delay is 10 minutes.

To redefine this 10 minute delay period, the DWORD registry value called MissedTasksStartupDelay under the key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\Configuration can be modified. The default value is 600 seconds (10 minutes) but this can be changed.

The next time the task scheduler service starts (at next start-up), any tasks with this option defined will start after the updated value.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .