Scheduled Tasks intermittently not starting batch jobs...

James Morgan 35 Reputation points
2025-08-13T13:55:54.59+00:00

We have a 2012R2 server that we use to transfer files. These file transfers (that are run from batch files) are central to our business and therefore have to be reliable. They've been running for years without incident. Recently, the task scheduler has developed an issue starting the batch files. The problem is completely random in that there doesn't seem to be any particular batch file that doesn't start. It could be any of them at any given time. We discover that a batch job hasn't run when the file its supposed to transfer doesn't make it to its destination. The task scheduler log will say that it ran, but the file transfer log will have no entry for the time frame that task scheduler says it was run. And, when one doesn't run, we'll open task scheduler and run it manually. When we do that, it always runs fine. So, it doesn't appear to be a file permissions or path problem. We're going to decommission this server in the future, but its what we have for the time being. In the meantime, how do I monitor cmd.exe and catch it when it either doesn't start or fails to run the batch file. I'd like to get that event into a log that we can review. Thanks.

Windows for business | Windows Server | Performance | System performance
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Harry Phan 140 Reputation points Independent Advisor
    2025-08-14T10:01:49.73+00:00

    Dear James Morgan,

    Based on your description and similar cases reported by other users, the issue appears to be related to Task Scheduler inconsistently launching cmd.exe, even though logs indicate the task has run. Since manual execution works reliably, this rules out file path and permission issues.

    To help monitor and capture failures when cmd.exe does not launch or the batch file fails silently, we suggest the following:

    1. Enable Task History In Task Scheduler, click Enable All Tasks History (under the right-hand Actions pane). This will provide more granular logs under Event Viewer > Applications and Services Logs > Microsoft > Windows > TaskScheduler > Operational.
    2. Add Logging to Batch Files Modify each batch file to log its start and end time This helps confirm whether the batch file was actually launched.
    3. Use Task Scheduler Return Codes Review the Last Run Result column for error codes. A result of 0x0 means success, but other codes may indicate silent failures.
    4. Create a Wrapper Script Instead of launching the batch file directly, use a PowerShell wrapper to log execution and errors:
    5. Check for Resource Contention Random failures may be due to system resource spikes. Use Performance Monitor to track CPU and disk I/O during scheduled task windows.

    I hope this helps

    Best regards,

    Harry Phan

    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.