This project has moved and is read-only. For the latest updates, please go here.

Problems with Windows 10. Tasks are scheduled, repetitions is postponed on each cycle, but are not attempted to run

Topics: Errors
Dec 5, 2016 at 3:44 AM
This is a very strange issue.
I've been using your library for almost a year now (thank you!) and never encountered any issue that wasn't from my own errors.

Now I've found out that the same task configuration that works perfectly under Windows 7 and 8, on x86/x64 and different languages, is failing on Windows 10.

I've tested on 2 different virtual machines, using different Windows 10 installation files and I have the same strange behavior on both.

Basically tasks won't launch when supposed to by daily or login repetition triggers.
They can also be launched manually and launch once on user login, but but repetitions are postponed each time they should run, without any indication that they were attempted to run on tasks history (it is enabled).

There are no conditions I can see that would prevent them to be run (such as being on battery or only on idle). Plus, like I mentioned the exact same program is able to create scheduled tasks which execute flawlessly on previous Windows version.
I even exported the XML from a Windows 7 x64, imported it into a clean Windows 10 VM and it has the same issue.

I'm pasting the XML export of the task, do you need any part of the code?
I think the XML is easier to follow, but let me know if you'd like the code.

Please let me know if you need further information.
Any help would be greatly appreciated, since now we are over 20% of adoption for Windows 10, so this is affecting me greatly.

Thank you.

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2016-06-02T16:32:22.334-08:00</Date>
    <Description>Test</Description>
    <URI>\TestTask</URI>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <Repetition>
        <Interval>PT15M</Interval>
        <StopAtDurationEnd>false</StopAtDurationEnd>
      </Repetition>
      <StartBoundary>2016-06-02T16:32:22.334-08:00</StartBoundary>
      <Enabled>true</Enabled>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
    <LogonTrigger>
      <Repetition>
        <Interval>PT15M</Interval>
        <StopAtDurationEnd>false</StopAtDurationEnd>
      </Repetition>
      <Enabled>true</Enabled>
      <Delay>PT1M</Delay>
    </LogonTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>S-1-5-21-2302200855-1744179440-2378765128-1002</UserId>
      <LogonType>InteractiveToken</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>true</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <Duration>PT10M</Duration>
      <WaitTimeout>PT1H</WaitTimeout>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>C:\Users\user\Downloads\TestTask.exe</Command>
    </Exec>
  </Actions>
</Task>
Coordinator
Dec 6, 2016 at 10:01 PM
I'm curious, could the task still be running from the last execution? I noticed you don't have MultipleInstancesPolicy set to terminate or run a new instance. I was able to load the XML on my Win10 instance. Also you should know that these two triggers do the same thing and you are effectively running it twice every 15 minutes.
Dec 14, 2016 at 3:14 PM
Hi Dahall, thanks for your reply.

The task was not running, I could see status was "Ready" and I was monitoring for an executable run by this and it was not present on task manager.
If I switch from Calendar to Time trigger, it works perfectly. Obviously that forces me have to re-register the task each time it is run.

My reasoning for running it on both login and calendar/time trigger is that if the computer is rebooted, I want the task to run as soon as possible and not have to wait 15 - X minutes to start. The program closes itself if it detects another instance running.

Was the task triggered on your Windows 10 instance after loading it? I don't know, it might be a bug on my particular release, but it happened with 2 different installation mediums.

Thank you.
Coordinator
Jan 10 at 4:34 PM
I was unable to duplicate your error on either Win10 systems I have. I have made some changes to limit the repetitive runs after the logon trigger and explicitly set the MultipleInstancesPolicy:
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2016-06-02T16:32:22.334-08:00</Date>
    <Description>Test</Description>
    <URI>\TestTask</URI>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <Repetition>
        <Interval>PT15M</Interval>
        <StopAtDurationEnd>false</StopAtDurationEnd>
      </Repetition>
      <StartBoundary>2016-06-02T17:32:22-07:00</StartBoundary>
      <Enabled>true</Enabled>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
    <LogonTrigger>
      <Enabled>true</Enabled>
      <Delay>PT1M</Delay>
    </LogonTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>S-1-5-21-839522115-1383384898-515967899-301783</UserId>
      <LogonType>InteractiveToken</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>Parallel</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>false</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>PT0S</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>C:\Users\user\Downloads\TestTask.exe</Command>
    </Exec>
  </Actions>
</Task>
Mar 24 at 9:09 AM
It's a must for windows 10: set start date and time to be in future (near future, just 1 minute), task will be triggered and will repeat at specific interval.
Marked as answer by dahall on 3/24/2017 at 9:10 AM