• Tip: Task Scheduler says constantly running

    From T@T@invalid.invalid to alt.comp.os.windows-11 on Wed Apr 29 22:06:09 2026
    From Newsgroup: alt.comp.os.windows-11

    Hi All,

    W11-25H2 V2

    I was working a a task that a customer wanted run
    from the Task Scheduler. Every time I tested
    is said "running". It should have exited almost
    instantly.

    I tore my hair out trying to figure out why is never
    exited. Turns out, all I had to do was press "F5"
    to refresh the Task Scheduler screen. My code way
    fine!

    HTH some else,
    -T
    --
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Serious error.
    All shortcuts have disappeared.
    Screen. Mind. Both are blank.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From VanguardLH@V@nguard.LH to alt.comp.os.windows-11 on Thu Apr 30 00:22:57 2026
    From Newsgroup: alt.comp.os.windows-11

    T <T@invalid.invalid> wrote:

    W11-25H2 V2

    I was working a a task that a customer wanted run
    from the Task Scheduler. Every time I tested
    is said "running". It should have exited almost
    instantly.

    I tore my hair out trying to figure out why is never
    exited. Turns out, all I had to do was press "F5"
    to refresh the Task Scheduler screen. My code way
    fine!

    After running a scheduled task, Task Scheduler does not automatically
    refresh its display nor refresh when status of a task changes. You run
    a task, refresh, and then check status.

    menu: Action -> Refresh
    Actions panel -> Refresh
    F5 also works.

    Commands to services are asynchronous: Task Scheduler, or sc.exe, issue
    the command, but there is no response from the service for the Task
    Scheduler to trigger upon to know the service's state has changed. When
    Task Scheduler issues a state change, it doesn't wait and report a state change, because service didn't report the state change hence Task
    Scheduler (or sc.exe, the service controller) are asynchronous to the
    effect of the commands they sent to the services. That's why you have
    to be careful when bringing up some services that you do so in the
    correct order, and refresh to see when the dependent services are ready.

    The services do not issue a semaphore or signal when they've changed
    state. The Task Manager won't know until it polls the service, and
    that's done on a refresh.

    Been that way for a very long time. Probably back through all NT-based versions of Windows. Commands are asychronous to the service state.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Andy Burns@usenet@andyburns.uk to alt.comp.os.windows-11 on Thu Apr 30 09:34:49 2026
    From Newsgroup: alt.comp.os.windows-11

    T wrote:

    I was working a a task that a customer wanted run
    from the Task Scheduler.  Every time I tested
    is said "running".  It should have exited almost
    instantly.

    Task Manager doesn't auto-refresh the status, you have to use F5.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From T@T@invalid.invalid to alt.comp.os.windows-11 on Thu Apr 30 04:01:58 2026
    From Newsgroup: alt.comp.os.windows-11

    On 4/30/26 01:34, Andy Burns wrote:
    T wrote:

    I was working a a task that a customer wanted run
    from the Task Scheduler.  Every time I tested
    is said "running".  It should have exited almost
    instantly.

    Task Manager doesn't auto-refresh the status, you have to use F5.

    It sure seemed to on many of the other things I was testing.

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Andy Burns@usenet@andyburns.uk to alt.comp.os.windows-11 on Thu Apr 30 12:26:03 2026
    From Newsgroup: alt.comp.os.windows-11

    T wrote:

    Andy Burns wrote:

    Task Manager doesn't auto-refresh the status, you have to use F5.

    It sure seemed to on many of the other things I was testing.
    It may do it on a longish interval, but not reliably ...

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From JJ@jj4public@gmail.com to alt.comp.os.windows-11 on Thu Apr 30 19:24:41 2026
    From Newsgroup: alt.comp.os.windows-11

    On Thu, 30 Apr 2026 12:26:03 +0100, Andy Burns wrote:
    T wrote:

    Andy Burns wrote:

    Task Manager doesn't auto-refresh the status, you have to use F5.

    It sure seemed to on many of the other things I was testing.
    It may do it on a longish interval, but not reliably ...

    The task may perform on data that the customer kept adding, which of course, lengthen the time for the task to complete each time more data is added.

    Did the custom don't think that, more data require more time to process?
    Or does the customer not aware that, the data grows bigger over time?

    Or maybe the storage performance has decreased due to its age?
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From T@T@invalid.invalid to alt.comp.os.windows-11 on Thu Apr 30 15:07:56 2026
    From Newsgroup: alt.comp.os.windows-11

    On 4/30/26 05:24, JJ wrote:
    On Thu, 30 Apr 2026 12:26:03 +0100, Andy Burns wrote:
    T wrote:

    Andy Burns wrote:

    Task Manager doesn't auto-refresh the status, you have to use F5.

    It sure seemed to on many of the other things I was testing.
    It may do it on a longish interval, but not reliably ...

    The task may perform on data that the customer kept adding, which of course, lengthen the time for the task to complete each time more data is added.

    Did the custom don't think that, more data require more time to process?
    Or does the customer not aware that, the data grows bigger over time?

    Or maybe the storage performance has decreased due to its age?


    ChatGPT had me chasing after whether the task was still running
    or no. It wasn't. Then I thought about refreshing the page
    and came up with "f5" when I could not find "refresh" in any
    of the pull downs.

    This one need a refresh:

    <Exec>
    <Command>cmd.exe</Command>
    <Arguments>/c taskkill /IM QBW.EXE /F &gt;nul 2&gt;&amp;1 &amp;
    timeout /t 2 &gt;nul &amp; tasklist /FI "IMAGENAME eq QBW.EXE" | find /I "QBW.EXE" &gt;nul &amp; exit /b %errorlevel%</Arguments>
    </Exec>


    This one did not

    <Exec>
    <Command>C:\Rakudo\bin\raku.exe</Command>
    <Arguments>C:\NtUtil\Alpen.Backup.raku --rotates 20
    --UNC_BackupPath [BACKUP]\MyDocsBackup\backup1</Arguments>
    <WorkingDirectory>C:\NtUtil</WorkingDirectory>
    </Exec>


    I am no stranger to the Task Scheduler, but this is
    the first time I have seen this inconsistent behavior.

    So I thought I'd post the f5 tip in case anyone else
    started pulling their hair out too.

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From VanguardLH@V@nguard.LH to alt.comp.os.windows-11 on Thu Apr 30 17:56:29 2026
    From Newsgroup: alt.comp.os.windows-11

    T <T@invalid.invalid> wrote:

    On 4/30/26 05:24, JJ wrote:
    On Thu, 30 Apr 2026 12:26:03 +0100, Andy Burns wrote:
    T wrote:

    Andy Burns wrote:

    Task Manager doesn't auto-refresh the status, you have to use F5.

    It sure seemed to on many of the other things I was testing.
    It may do it on a longish interval, but not reliably ...

    The task may perform on data that the customer kept adding, which of course, >> lengthen the time for the task to complete each time more data is added.

    Did the custom don't think that, more data require more time to process?
    Or does the customer not aware that, the data grows bigger over time?

    Or maybe the storage performance has decreased due to its age?

    ChatGPT had me chasing after whether the task was still running
    or no. It wasn't. Then I thought about refreshing the page
    and came up with "f5" when I could not find "refresh" in any
    of the pull downs.

    This one need a refresh:

    <Exec>
    <Command>cmd.exe</Command>
    <Arguments>/c taskkill /IM QBW.EXE /F &gt;nul 2&gt;&amp;1 &amp; timeout /t 2 &gt;nul &amp; tasklist /FI "IMAGENAME eq QBW.EXE" | find /I "QBW.EXE" &gt;nul &amp; exit /b %errorlevel%</Arguments>
    </Exec>

    This one did not

    <Exec>
    <Command>C:\Rakudo\bin\raku.exe</Command>
    <Arguments>C:\NtUtil\Alpen.Backup.raku --rotates 20
    --UNC_BackupPath [BACKUP]\MyDocsBackup\backup1</Arguments>
    <WorkingDirectory>C:\NtUtil</WorkingDirectory>
    </Exec>

    I am no stranger to the Task Scheduler, but this is
    the first time I have seen this inconsistent behavior.

    So I thought I'd post the f5 tip in case anyone else
    started pulling their hair out too.

    When you start, stop, or disable a task with, say, sc.exe (service
    controller), you need to query status of the service to determine when
    its state actually changed before using sc.exe to start another service
    that depends on the prior one.

    sc.exe start <servicename>
    sc.exe query <servicename>

    You would need to parse the output of the 2nd sc command to determine if
    the service started, like in a for-loop looking for status, and exiting
    the loop when the service started, or after a number of retries with a
    delay between each query.

    Service state change is asynchronous to the commands to affect services.
    You can issue the "sc start <service>" command, but it's not going to
    hang around waiting until the service reports it started or failed. sc
    is asynchronous to (independent of) the service state.

    Start the service, and keep querying it to see if and when it changed
    state. Refreshing the UI for Services (services.msc) is just it doing
    another query.
    --- Synchronet 3.21d-Linux NewsLink 1.2