1

I've used Task scheduler and created a new task, added a trigger, set it to event: on Idle and created the task. In the conditionstab, specified the task waits 1min to become idle (instead of 10min just to test).

But then I wait for more than 10mins and the task is never triggered on PC1 but triggers on another PC2. Also if I press Run in Task Scheduler the task runs normally in PC2 it just never triggers automatically when idle for 1 min. I've checked online and found that PowerCfg -requests will show what is stopping the PC from being Idle and when I run it on PC2 nothing returns but when I run it on PC1 I get this "Legacy Kernel Caller" driver.

So I used Powercfg -requestsoverride but when I run powercfg -requestsoverride Driver "Legacy Kernel Caller" System , where it succeeds and I find it in the Powercfg -requestsoverride list, but then powercfg -requests it still shows [DRIVER] Legacy Kernel Caller under SYSTEM: and the task is never triggered any advice please?

Below is how my scheduled task looks in task scheduler:

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Also here is the xml of my Task:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2019-11-20T15:43:06.6081219</Date>
    <Author>MyPC\MyUser</Author>
    <URI>\MyAppIdleTask</URI>
  </RegistrationInfo>
  <Triggers>
    <IdleTrigger>
      <Enabled>true</Enabled>
    </IdleTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>S-1-5-21-1004336348-1177238915-682003330-385281</UserId>
      <LogonType>InteractiveToken</LogonType>
      <RunLevel>LeastPrivilege</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <Duration>PT1M</Duration>
      <WaitTimeout>PT0S</WaitTimeout>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>true</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>C:\MyWinFormApp\MyWinForm.exe</Command>
    </Exec>
  </Actions>
</Task>
Tak
  • 481
  • 2
  • 5
  • 20

1 Answers1

0

There are several things you need to watch for when you schedule a task.

One of the main ones I found is the timing.

For example, let's say it's 0018h right now and you schedule a task to run at 0000h daily every 5 minutes. You make all settings, put all conditions, test-start the task and it's fine, all seems good but the task will not start even if the conditions are met. That happens because of the exceeded schedule. It will only start at the next 0000h. So if it's 0018h and you actually want to see the task working, put it at an immediately later time instead, like 0024h and make sure that the set time is not exceeded while you're configuring it.

Then, you can make sure other conditions are fine, like the ones related to power-states, network availability, success state.

Another very important aspect: make sure the credentials used to run it have enough privileges to actually run it. That part is easier to check because you can manually test it.

Overmind
  • 9,924
  • 4
  • 25
  • 38
  • My task is not scheduled in the way you said, it's set to start when computer is idle for 1 min, but it never starts in PC1. Also if I press Run in Task Scheduler the task runs normally. I've updated the question with screenshot of the task details if you could check. – Tak Jul 15 '20 at 08:57
  • What is in the idle settings tab ? Did you set activation time ? It's a similar case with what I said in the answer. If it works manually means credentials are fine, you need to make sure activation conditions are good also. The settings part depend a lot on what the task does; more details are needed here like how much time must it run ? – Overmind Jul 15 '20 at 09:30
  • I’ve included screenshots including one of the settings tab in the question. The activation is to ‘start the task only if the computer is idle for 1 minute’. The task runs an exe of a winform application I made which is just a windows form that opens with some info then the user normally will close it down like any other window. – Tak Jul 15 '20 at 09:40
  • I meant what's under triggers --> idle/edit. – Overmind Jul 15 '20 at 09:54
  • I've updated my question with a screenshot of the triggers edit window and I've also included the xml of the task. – Tak Jul 15 '20 at 10:21
  • Set activate to a later than now time and use repeat if you want it to re-spawn more than 1 time. – Overmind Jul 15 '20 at 12:09
  • Okay will do that, will this make it triggered once the computer is Idle for 1 min? – Tak Jul 15 '20 at 12:11
  • Should fix the stating problem. – Overmind Jul 15 '20 at 12:44
  • Okay, will try it. Just to confirm so I will have to activate it only once (setting a time after current time) and it should work all the time in the future without having to reset it? – Tak Jul 15 '20 at 12:45
  • I just tried it and set activate to a later than now time and it didn't trigger. – Tak Jul 15 '20 at 14:04
  • There must be something else preventing it. As a general picture, activation conditions are a cumulative requirement so if only one condition is not good/not set, it will not work. – Overmind Jul 16 '20 at 05:41
  • Could you check this please: https://superuser.com/q/1568909/391215 – Tak Jul 16 '20 at 07:44