Windows 11 Task Scheduler not working for some tasks

Barry W. Guidry 0 Reputation points
2024-10-08T12:12:41.22+00:00

I have a new pc, including Windows 11 Pro. I am having a problem with some scheduled tasks not running, which I had running on a previous laptop which also included Windows 11 Pro. I am stumped as to why some tasks do not run on the new pc. I regularly run Windows Update. Everything else works fine. I have modified several settings/options for each task, to try again. Has anyone else experienced this problem?

Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. MotoX80 36,291 Reputation points
    2024-10-08T12:37:36.15+00:00

    some scheduled tasks not running, modified several settings/options for each task

    You need to provide details in order for us to help you. Is the task not being triggered? Or is the Task Scheduler running the task, but the program it executes doesn't appear to do anything? What settings/options are you changing?

    In the Task Scheduler, in the Actions pane select "Enable All Tasks History". Then you can review the History tab for each task to see what the Task Scheduler did with it. Verify that they are being triggered.

    You need to capture stdout and stderr from whatever programs you are running to see what console output they produce.

    Create a bat file that executes your program. Echo %date% %time% as the first and last line the .bat so that you know when the task starts and ends.

    @echo %date% - %time% MyScript is starting.
    SomeProgram.exe  
    @echo %date% - %time% MyScript is ending. SomeProgram RC=%errorlevel% 
    

    Then change the scheduled task to execute program "cmd.exe".

    In the arguments field set it will look like this example:

    /c C:\Scripts\MyScript.bat  1>>"C:\Scripts\Logs\MyScript-%date:~10,4%-%date:~4,2%%date:~7,2%.log" 2>&1
    

    That will create a daily log file of all executions of the task. It will capture stdout and stderr for programs that get called. Be sure to include the double quotes around the file name because of the space in the hours when there is only a single digit.

    Then analyze the log file for success/error messages from the program(s).


  2. Barry W. Guidry 0 Reputation points
    2024-10-11T14:59:03.76+00:00

    The problem was unrelated to Windows Task Scheduler, but the Pythonw.exe version that I had the scheduled task to run. In ArcGIS Pro Desktop one can clone the Python package environment, in order to add python packages. Therefore, my scheduled task was pointing to Pythonw.exe from the cloned package path. I changed the path to point back to the original Pythonw.exe application, which works.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.