How to fix task scheduler jobs completed within 1-2 seconds, but it did not trigger the batch file/execution file at all

JohnGan 5 Reputation points
2023-12-27T06:12:48.6233333+00:00

Good day to all,

I encountered a weird situation on Windows task scheduler jobs where the jobs were completed within seconds but the batch script/exe of the job did not get executed.

Server specification:

VM

2.39 GHz CPU

32 GB RAM

Microsoft Windows Server 2019 Standard

Summary:

The Windows task scheduler jobs were trigger under an local Administrator user account and they are working fine all the while. However, after some days or weeks, it encountered the issue as mentioned. The Windows task scheduler jobs start and complete within 1-2 seconds, but the batch/exe did not get triggered. The jobs were completed with return code 3221225794 in the task scheduler. The temporary workaround that I found online was to reboot the server and it works, yet it did not resolve the issue as the issue was reoccurring.

Windows for business | Windows Server | User experience | Other
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Dikky Ryan Pratama 1,470 Reputation points
    2023-12-27T06:26:44.8566667+00:00

    Hi JohnGan,

    The issue you're encountering, where Windows Task Scheduler jobs complete quickly without executing the associated batch script or executable, can have various causes. The return code 3221225794 (0xC0000142) generally indicates an application failure. Here are some steps and considerations to troubleshoot and potentially resolve the issue:

    1. Check Event Viewer:

    • Examine the Windows Event Viewer for any relevant error messages or warnings that might provide more information about the failure.

    2. Review Task Scheduler History:

    • In Task Scheduler, check the "History" tab for the failed tasks. It might provide additional details on why the task failed.

    3. Run Task Manually:

    • Try running the task manually to see if it executes correctly. This can help determine if the issue is related to the task itself or the scheduled trigger.

    4. Update Task Scheduler Service Account:

    • If your task relies on network resources, ensure that the Task Scheduler service account has the necessary permissions.

    5. Check for Antivirus or Security Software Interference:

    • Some antivirus or security software may interfere with scheduled tasks. Temporarily disable or configure the software to allow the task to run.

    6. Verify Batch Script or Executable:

    • Ensure that the batch script or executable isn't encountering errors or exceptions during execution. Running it manually might reveal any issues.

    7. Check for Resource Exhaustion:

    • Monitor system resources (CPU, RAM) during the execution of the task. Resource exhaustion might lead to the task failing.

    8. Update Windows and Task Scheduler:

    • Ensure that your system is up-to-date with the latest Windows updates and patches. An outdated Task Scheduler or related components could be causing issues.

    9. Increase Task Scheduler Logging:

    • You can increase the logging level for Task Scheduler to get more detailed information. You can do this using the following registry key:
      
        HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\Configuration
      
      
      Set the Verbose DWORD value to 1.

    10. Consider a Different Trigger:

    • If the issue is related to a specific trigger, try using a different trigger (e.g., time-based rather than event-based) to see if the problem persists.

    11. Check for Script/Executable Dependencies:

    • If your script or executable depends on certain environment variables, paths, or network resources, ensure that these dependencies are available when the task runs.

    12. Review Task Scheduler Limits:

    • Check if the task scheduler limits (e.g., maximum execution time) are affecting the task.

    13. Capture Process Dumps:

    • Use tools like ProcDump to capture process dumps when the issue occurs. Analyzing these dumps might provide insights into the cause of the failure.

    14. Consult Microsoft Support:

    • If the issue persists, consider reaching out to Microsoft Support for assistance. They can provide more in-depth analysis and guidance.

    Implementing these steps should help you identify and address the root cause of the issue. If the problem persists, gathering detailed information from logs and exploring the system's behavior during task execution will be crucial for further troubleshooting.

    Regards.

    4 people found this answer helpful.
    0 comments No comments

  2. Anonymous
    2023-12-29T07:24:12.8466667+00:00

    Hi John,

    Welcome to the Windows Q&A community.

    Please make sure the task is configured to run under local admin account so that it is supposed to have all required permissions to run that batch script.

    Also, kindly update the system to the latest version because we have experienced similar issues and was resolved by updating Windows.

    As a workaround, you can also create another task scheduler to reboot the computer after completing the task scheduler jobs.

    Best Regards,

    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    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.