Share via

Task Scheduler Issue is closing without run completion

2026-04-08T13:43:59.45+00:00

we have scheduled SAS report jobs on our Windows servers (Windows Server 2019 Data Center , 64bit, version-1809, OS Build- 17763.8511) in the task scheduler.These SAS reports jobs trigger using vbs script files. Sometimes if the actual job run time is around 5min the job is triggering at scheduled time but it is running for only few seconds (ex:12sec) and it is closing without job completion (shorter run issue). could you please help us to provide solution for this issue.

Windows for business | Windows Server | User experience | Other

1 answer

Sort by: Most helpful
  1. Daphne Huynh (WICLOUD CORPORATION) 660 Reputation points Microsoft External Staff Moderator
    2026-04-14T07:18:23.7166667+00:00

    Welcome to Microsoft Q&A Forum!

    When a scheduled task on Windows Server 2019 starts successfully but terminates after only a few seconds without completing, this behavior is usually caused by task configuration, execution context or script behavior, not by a failure of Task Scheduler itself. The common causes include:

    • Missing or incorrect “Start in” (working directory)

    Scripts that rely on relative paths (VBS, SAS jobs, batch files) may exit immediately when run by Task Scheduler because the default working directory is C:\Windows\System32 if not explicitly set.

    • Non‑interactive execution context Scheduled tasks run in a background session. Scripts that depend on:
      • User profiles
      • Mapped drives (not UNC paths)
      • UI prompts or dialogs may exit early when running unattended.
    • Execution limits configured in the task

    The setting “Stop the task if it runs longer than…” can prematurely terminate jobs, especially legitimate long‑running report or ETL tasks.

    • Script exits without throwing an error If a script encounters a missing dependency or logic path that triggers an early exit, Task Scheduler will not report a failure unless script‑level logging is implemented

    I would like to share the following recommended solutions that may help you.

    1. Validate the task configuration

    Microsoft recommends verifying:

    • Program/Script
    • Arguments
    • Start in (explicitly set the correct working directory)
    • Run whether user is logged on or not
    • Disable execution time limits temporarily for testing.

    2. Test the script outside Task Scheduler

    Run the script manually using its intended host (for example, cscript.exe for VBS). If it exits early outside Task Scheduler, the issue is script‑side, not scheduler‑side.

    3. Monitor server resource utilization

    High CPU, memory pressure, or disk I/O contention during peak periods can cause:

    • Script timeouts
    • Dependent processes failing to initialize Microsoft recommends monitoring resource usage during task execution.

    4. Add script‑level logging

    Microsoft explicitly advises not relying solely on Task Scheduler status:

    • Log entry/exit points inside the script
    • Capture exit codes
    • Log errors before termination This is often the only way to determine why a task exits early in unattended mode.

    Note: If a scheduled task starts and then stops after a few seconds, Task Scheduler is working as designed. Microsoft documentation shows the root cause is almost always script execution context, working directory, or task execution limits, not Task Scheduler itself. Correcting the task configuration and ensuring the script is designed for unattended execution resolves this issue in most cases.

    Reference: Scheduled Tasks Not Running - Windows Server | Microsoft Learn

    I hope this information is helpful and thank you for choosing Microsoft Q&A to raise your concern.

    0 comments No comments

Your answer

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