Task Scheduler not triggering for 'Start when PC is Idle' command.


  1. Posts : 26
    Microsoft Windows 10 Home 64-bit 19045 Multiprocessor Free - 22H2
       #1

    Task Scheduler not triggering for 'Start when PC is Idle' command.


    I have a program that I want to shut down/kill after a certain amount of time being idle. I set up a task following the instructions from the top comment in this thread, minus the fact that instead of shutting my PC down, I used the taskkill command.

    I can get the program to shut down ONLY when it hits the scheduled time. It never does it while I'm idle.

    I clean booted/stopped all startup programs and checked my powercfg.exe -requests to make sure nothing was preventing an idle state, but I'm still unable to achieve the result I want. It's as if my computer simply isn't able to enter an idle state.
      My Computer


  2. Posts : 18,032
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #2

    Hello @Bros3ph,

    Welcome to TenForums.

    I don't know if a list of Scheduled Tasks will help [ Look at the State column ].

    Copy & Paste the following [ ALL at once ] into a CMD Prompt and press Enter.

    Code:
    
    @echo off
    echo. & PowerShell ^
         $Tot=((Get-ScheduledTask) ^| Measure-Object).Count; ^
         $List=(Get-ScheduledTask  ^| Sort-Object -Property TaskName ^| Format-Table -AutoSize ^
         @{L='Task Name';E={;if([string]::IsNullOrWhiteSpace($_.TaskName)) {'-'} else {$_.TaskName}}}, ^
         @{L='State'    ;E={;if([string]::IsNullOrWhiteSpace($_.State))    {'-'} else {$_.State}}}, ^
         @{L='Task Path';E={;if([string]::IsNullOrWhiteSpace($_.TaskPath)) {'-'} else {$_.TaskPath}}} ^| ^
    Out-String -Width 1000).Trim("""`r`n"""); ^
         if ($List.Length) {Write-Host """`n--- Scheduled Task(s) [$Tot] - Sorted by [TaskName] ---`n`n `n`n$List"""} else ^
                           {Write-Host """`n--- NO Scheduled Task(s) Available ---"""; exit 1} >> %Temp%\A.txt
         for /f "delims=" %i in (%Temp%\A.txt) do echo. %i
         del %Temp%\A.txt
    echo. & echo ^>Press ANY key to EXIT . . . & pause >nul & Exit
    
    

    I hope this helps.
      My Computer


  3. Posts : 26
    Microsoft Windows 10 Home 64-bit 19045 Multiprocessor Free - 22H2
    Thread Starter
       #3

    Hi Paul, thanks for the quick reply.

    This is what it looks like

    I named the Task 'Shutdown'. I'm not very experienced with Task Scheduler so I'm not sure where to go from here.
      My Computer


  4. Posts : 18,032
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #4

    Hello @Bros3ph,

    Have you looked at this ? > How to Create Task to Run App or Script at Logon in Windows 10

    Also, have a look at the Related Tutorials at the BOTTOM of the above Tutorial as they may also be useful.

    I hope this helps.
      My Computer


  5. Posts : 26
    Microsoft Windows 10 Home 64-bit 19045 Multiprocessor Free - 22H2
    Thread Starter
       #5

    Hi Paul,

    I think I have a decent idea about how to set up a task and how to get a task to execute at a specific time. For example, I can get my PC to shutdown or get the program to close. But I can only do this for the initial scheduled time. It only triggers for the time that I set.

    What I want is a task that triggers after my PC has been idle for a certain amount of time. No matter how long I leave my PC/Mouse alone, I cannot get tasks to trigger automatically. It's as if my PC isn't entering an idle state. I followed the guide I mentioned earlier, as it was meant to trigger a task when you're idle.

    Thank you
      My Computer


  6. Posts : 17,092
    Windows 10 Home x64 Version 22H2 Build 19045.4894
       #6

    Perhaps this MS article explains what you are experiencing - Task idle conditions - MSLearn
    MS said:
    In Windows 7, the Task Scheduler verifies that the computer is in an idle state every 15 minutes
    MS said:
    The Duration and WaitTimeout settings are deprecated. They're still present in the Task Scheduler user interface, and their interface methods may still return valid values, but they're no longer used.
    These might also be useful.
    Task Scheduler - On Idle does not wait - TenForums - my post #6 might be a solution for you but I'm not at all sure that it suits your needs.
    What is Wait for idle for - Super User
    on idle problems and a retracted explanation - EightForums
    TaskScheduler - Task Idle Conditions - ServerFault
    Idle and the effect of rebooting - SevenForums


    Best of luck,
    Denis
    Last edited by Try3; 23 Apr 2023 at 05:55.
      My Computer


  7. Posts : 45,607
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #7

    Hi, I've created such a task- it occasionally runs and (in this test case) launches Wordpad.

    I suspect the underlying issue is 'what is the definition of idle'? CPU usage? It's evidently not as simple as 'no mouse movement', 'no use of keyboard'.

    Task Scheduler not triggering for 'Start when PC is Idle' command.-1.jpg
    Task Scheduler not triggering for 'Start when PC is Idle' command.-2.jpg
      My Computers


  8. Posts : 17,092
    Windows 10 Home x64 Version 22H2 Build 19045.4894
       #8

    Idle is defined in the MS article I linked to.

    All the best,
    Denis
      My Computer


  9. Posts : 281
    Windows 10 Pro
       #9

    I never got that function of idle to work in Task Scheduler. Other triggers I have gotten to work, just not idle, and based on how it works it's no wonder. My use case is to automatically turn the PC off at a certain time if there is no PC activity. And for that I use a program called Airytec. So far it's working under Windows 10.

    If you want to shutdown a program when the computer is idle, you'll need to create a cmd script (batch file) and tell Airytec about it.

    So if you wanted to end the calculator the code would be like this:


    Code:
    @echo off 
    taskkill /f /im win32calc.exe
    i.e. the process name shown in Task Manager. Might have to right click the process in Task Manager to see its .exe file...

    Then name the script something like end task.cmd and drop that into the C:\Program Files\Airytec\Switch Off\scripts directory.


    I set my CPU utilization time in Airytec to 10% which is the defined idle state to meet in order to trigger the event in Airytec. If there are updates and other crap in the background it'll prevent the script from firing off in Airytec...
      My Computer


  10. Posts : 45,607
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #10

    This free prog offers some interesting options to specify when the PC is shut down etc, not just at a specific time. See screenshot for one example.

    It also blocks sleep ... etc
    Task Scheduler not triggering for 'Start when PC is Idle' command.-untitled.png
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 21:29.
Find Us




Windows 10 Forums