Guide · Windows
Monitor Windows Scheduled Tasks (Task Scheduler)
Task Scheduler keeps a "Last Run Result" column and a History tab, but nothing looks at either unless you go and check. Add a check-in action to the task and Mortemain pages you the moment a run goes missing, hangs, or exits with an error, no agent installed on the box.
1. Create a check
Create a check in Mortemain matching the task's schedule and an appropriate grace window, then copy its ping URL:
https://ping.mortemain.com/your-check-uuid
2. Add a check-in action to the task
In Task Scheduler, open the task's properties and go to the Actions tab. Task Scheduler runs every action in order regardless of whether the previous one succeeded, so a plain second action only proves the task fired, not that the real work finished cleanly. To get real success/failure semantics, replace the task's single action with one that chains the job and the ping, so the ping URL depends on the job's own exit code. The simplest way is a single Start a program action running cmd.exe:
Program/script: cmd.exe
Add arguments: /c "C:\jobs\backup.bat && curl.exe -fsS --max-time 10 https://ping.mortemain.com/your-check-uuid -o NUL || curl.exe -fsS --max-time 10 https://ping.mortemain.com/your-check-uuid/fail -o NUL"
curl.exe ships with Windows 10, Windows 11 and Windows Server 2019+, so there is nothing to install. && only runs the success ping if backup.bat exits 0; || runs the failure ping otherwise.
3. Or create the task from the command line
The same chained command works with schtasks, useful for provisioning a task alongside a deployment script:
schtasks /create /tn "Nightly Backup" /sc daily /st 02:00 /ru SYSTEM /tr "cmd.exe /c \"C:\jobs\backup.bat && curl.exe -fsS --max-time 10 https://ping.mortemain.com/your-check-uuid -o NUL || curl.exe -fsS --max-time 10 https://ping.mortemain.com/your-check-uuid/fail -o NUL\""
If the job is already a PowerShell script rather than a batch file, see the PowerShell guide for a try/catch pattern that pings success or /fail from inside the script itself; point the task's single action at that script instead of chaining commands here.
4. Optional: track run duration
Ping the /start endpoint before the job runs, so Mortemain can report how long each run takes and flag one that's drifting slower:
Program/script: cmd.exe
Add arguments: /c "curl.exe -fsS --max-time 10 https://ping.mortemain.com/your-check-uuid/start -o NUL & C:\jobs\backup.bat && curl.exe -fsS --max-time 10 https://ping.mortemain.com/your-check-uuid -o NUL || curl.exe -fsS --max-time 10 https://ping.mortemain.com/your-check-uuid/fail -o NUL"
While you're in the task's Settings tab, tick Do not start a new instance under "If the task is already running" (or similar, depending on OS build). Without it, an overlapping run can fire a second /start or a stray success ping mid-job.
Test it
Right-click the task and choose Run (or schtasks /run /tn "Nightly Backup"). Check should flip to up within seconds; the task's History tab (enable "Enable All Tasks History" from the Task Scheduler Library pane if it's greyed out) confirms both the job and the ping ran. Then break the batch file on purpose, e.g. make it exit 1, and run the task again: the down alert should arrive immediately via the /fail ping instead of waiting for the schedule's grace window to expire.