{
  "id": 12302807,
  "title": "Health Checks for a Fleet of Scheduled Tasks",
  "url": "https://urgent.news/2026/10/06/health-checks-for-a-fleet-of-scheduled-tasks",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-06T04:44:45.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/mattleeee/health-checks-for-a-fleet-of-scheduled-tasks-5db7"
  },
  "original_language": "en",
  "account": "Scheduled tasks, when left unattended, can form a fleet of potential issues. Checking them manually becomes a liability after a certain number, as one only looks when something is visibly broken. This post introduces an audit script that enumerates tasks based on names, checks their state and last result, and sends alerts when there's a problem. The script runs as a scheduled task itself, ensuring continuous monitoring. The Task Scheduler COM API (Schedule.Service) is the authoritative source for task information. The schtasks.exe text output is user-friendly but not suitable for parsing due to variable column widths and localized Windows installs. Use COM for reliable results. The script enumerates tasks and provides access to fields like Name (task name without folder path), Path (full task path), State (task state), Enabled (whether the task is enabled), LastRunTime (when the last run started), and LastTaskResult (the exit code of the last completed run). Two important considerations are that State and Enabled are not redundant, and LastTaskResult is only relevant after a run completes. A sentinel value of 1899-12-30 represents tasks with no next run. The script defines what constitutes a healthy task by setting expectations, such as patterns to match against task names, maximum allowable age for the last run time, and whether disabled tasks should be considered. These expectations are stored in a list of Expectation objects, each containing a pattern, maximum allowed age, optional description, and whether disabled tasks should be allowed. The script classifies tasks based on their state, enabled status, last result, and last run time. Possible classifications include ok (healthy), warn (warning), and fail (failure). The classification logic accounts for four distinct failure modes, each requiring different messages. Tasks can be disabled by design or currently running, and the script handles these scenarios appropriately.",
  "summary": "Nine unattended scheduled tasks is a fleet, whether you call it that or not. Once you pass three or four, checking taskschd.msc by hand stops being a habit and starts being a liability — you only look when something is visibly broken, which is exactly the failure mode you were trying to avoid by scheduling the work in the first place. This post covers a small audit script that enumerates a set of…",
  "key_points": [
    "Scheduled tasks can form a fleet of potential issues if unattended.",
    "The audit script enumerates tasks using Task Scheduler COM API."
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}