Windows Task Scheduler
Windows scheduled task monitoring for missed completion signals
Keep Windows Task Scheduler. Add a PowerShell heartbeat after your script succeeds, and PingCron watches for the next completion check-in. Start with one task and five free monitors.
5 monitors free · No credit card · Verify one real scheduled run
A task can be configured without its next run completing.
Task Scheduler history and job logs help explain a run. An independent expectation also catches missing completion when a host is offline, a trigger is disabled, or the job stops before sending its heartbeat.
Your task sends outbound HTTPS; no inbound connection is needed. You install the check-in. PingCron does not discover, start, restart, or inspect Windows tasks.
Check an existing Windows task before changing it
Run these read-only checks on the Windows computer that owns the task, with an account already allowed to inspect it. They do not start, stop or reconfigure a task. Keep task details and logs private when reviewing the results.
1. Read the exact task and its latest result
Copy the name and folder from Task Scheduler Library. Identical names can exist in different folders. Use \ for the root, or include both backslashes in a folder such as \Operations\. If the task cannot be read, verify the computer, name, path and existing access.
Download the read-only task snapshot, review it, and run it with your task name and folder. It uses Windows PowerShell 5.1 or later with the ScheduledTasks module. The monitoring wrapper below separately requires PowerShell 7.4+.
.\inspect-scheduled-task.ps1 -TaskName 'Daily backup' -TaskPath '\Operations\' | Format-ListRead the diagnostic script
#Requires -Version 5.1
# Read-only snapshot. Run on the Windows computer that owns the task.
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$TaskName,
[ValidateNotNullOrEmpty()]
[string]$TaskPath = '\'
)
$ErrorActionPreference = 'Stop'
$matchingTasks = @(Get-ScheduledTask -TaskPath $TaskPath -ErrorAction Stop | Where-Object {
$_.TaskName -eq $TaskName -and $_.TaskPath -eq $TaskPath
})
if ($matchingTasks.Count -ne 1) {
throw 'Expected exactly one readable task with that exact name and path.'
}
$selectedTask = $matchingTasks[0]
$info = Get-ScheduledTaskInfo -InputObject $selectedTask -ErrorAction Stop
if ($null -eq $info.LastTaskResult) {
throw 'The last task result was not available.'
}
[pscustomobject]@{
TaskName = $selectedTask.TaskName
TaskPath = $selectedTask.TaskPath
State = [string]$selectedTask.State
LastRunTime = $info.LastRunTime
NextRunTime = $info.NextRunTime
LastTaskResult = $info.LastTaskResult
LastTaskResultHex = '0x{0:X8}' -f ([long]$info.LastTaskResult -band 4294967295L)
NumberOfMissedRuns = $info.NumberOfMissedRuns
}
The snapshot shows State, LastRunTime, NextRunTime, LastTaskResult in decimal and hexadecimal, and NumberOfMissedRuns. These reads are not atomic: a task can change state between them. NextRunTime describes scheduling, not guaranteed completion; some triggers do not have a useful next-run time.
2. Separate a missed launch from incomplete work
- No recent launch
- Compare LastRunTime with the trigger you expected. Inspect the task's enabled state, trigger, Conditions and Settings, then its retained history. A stale timestamp alone does not identify why the job did not run.
- Still running
- Running, or scheduler status
0x00041301, calls for checking workload progress and elapsed time. Do not call it stuck or start another copy just because a completion heartbeat is absent. A previous result may not describe the active run. - An error or other status
0x00041303means the scheduler reports no previous run. Other nonzero values can be scheduler statuses, Windows errors or application exit codes. For example,0x1needs the invoked program's documentation and log, not a universal diagnosis. Read the full event before choosing a fix.- Success reported, but output is wrong
- A result of zero does not prove correct output. Check the artifact, destination or application records for that run. A backup file still needs a separate restore test. Ready means the task can run, not that its previous work was correct.
3. Correlate history with the workload
Open the selected task's History tab. In Event Viewer, the underlying channel is Applications and Services Logs > Microsoft > Windows > TaskScheduler > Operational. Match the full task path, run time and instance details, especially when runs overlap. Read task and action events alongside the application's own log and output.
Disabled, inaccessible or missing history does not prove that no run occurred. Logs may have expired, and a completed action event does not validate its output. This procedure does not enable history, change retention or request elevated privileges.
Once the current behavior is understood, add a completion heartbeat to the task. PingCron watches for expected check-ins. It does not read Windows history, execute tasks or inspect their output.
References: Microsoft runtime information · scheduler result codes · task troubleshooting. The downloadable script's selection and formatting are tested with synthetic task records; this is not a test of your task or its permissions.
Setup
Connect one task, then verify its scheduled completion.
Create a monitor to get its private success URL. Choose the task’s schedule and timezone, or an interval, and allow grace for normal runtime and delay. A new monitor waits for its first receipt.
Windows Task Scheduler: configure the action
Install PowerShell 7.4 or later. Save the wrapper below as C:\Scripts\monitored-task.ps1, replace the real job path, and provide PINGCRON_URL through the task account’s environment or a protected configuration file loaded by the wrapper. An interactive terminal variable is not enough. Keep the URL private.
For a script-only task, replace its action with the wrapper; keep the trigger and run-as account. Do not run the job twice. For multiple actions or background work, instrument actual completion.
- Program/script
C:\Program Files\PowerShell\7\pwsh.exe(verify your installed path)- Add arguments
-NoProfile -NonInteractive -File "C:\Scripts\monitored-task.ps1"- Start in
C:\Scripts(the working directory, not a script filename)
Verify this account’s file access, credentials, and outbound HTTPS. Without a working directory, Task Scheduler commonly starts in the Windows system directory. Follow your organization’s script-signing and execution policy.
The wrapper preserves the child script’s exit code. After successful work, a failed heartbeat produces a warning without changing that result. Check PingCron receipts alongside Task Scheduler history.
The PowerShell request has a 10-second connection timeout and a 10-second stalled-read timeout. These are not a total request deadline or a workload runtime limit. The Linux curl example limits the HTTP request to 10 seconds; a failed request can change that command’s final exit status.
For cron, keep the example on one physical line, replace the URL placeholder, and put comments on separate lines. Read the cron schedule and grace-period guide.
Send success after required work finishes. For queued work, instrument the worker’s completion. A heartbeat cannot prove output correctness or that a backup is restorable.
Real-world examples
PowerShell 7.4+ wrapper: C:\Scripts\monitored-task.ps1
#Requires -Version 7.4
$ErrorActionPreference = 'Stop'
if ([string]::IsNullOrWhiteSpace($env:PINGCRON_URL)) {
throw 'Set PINGCRON_URL in the scheduled task environment.'
}
# The real job must exit nonzero when required work fails.
& "$PSHOME\pwsh.exe" -NoProfile -NonInteractive -File "C:\Scripts\daily-job.ps1"
$jobExit = $LASTEXITCODE
if ($jobExit -ne 0) { exit $jobExit }
try {
Invoke-WebRequest -Uri $env:PINGCRON_URL -ConnectionTimeoutSeconds 10 -OperationTimeoutSeconds 10 -ErrorAction Stop | Out-Null
} catch {
Write-Warning 'Work completed, but the heartbeat request failed. Check monitoring setup.'
}
exit $jobExitLinux cron: one user-crontab line
0 2 * * * /scripts/daily-job.sh && curl --max-time 10 -fsS YOUR_MONITOR_SUCCESS_URL >/dev/null
Prove one scheduled task is monitored
- Run the configured task: use Task Scheduler’s Run action, inspect the workload output, and confirm the success receipt in PingCron. Then verify a later automatic trigger. Running a script in your terminal does not test the scheduled account and environment.
- Verify delivery: save an email, Slack, or Discord destination, send its labeled test, and confirm receipt. Set up and verify an alert destination. A delivery test does not simulate missed work.
- Test detection separately: activate an isolated short-interval test monitor, withhold its next heartbeat beyond interval plus grace, and confirm the overdue state and alert receipt. Send a success to check recovery, then pause that disposable monitor. Do not interrupt a production task for this test.
When more monitored tasks justify Pro
Free covers 5 monitors, 7-day receipt history, and email, Slack, and Discord alerts. Keep it if that meets your needs.
Pro is $9.99/month for one account owner: up to 50 monitors, 30-day receipt history, and alerts sent to custom webhooks. Choose it when you need more than five tasks or those history and integration features. Shared account access starts on Team.
Choose Pro: $9.99/monthCreate your account, then continue to checkout for the paid subscription.
Setup references: Microsoft Task Scheduler actions · PowerShell HTTP timeouts.
FAQ
Related monitoring guides
Monitor the next run you need to trust.
Start with five free monitors, seven-day receipt history, and email, Slack, or Discord alerts. Confirm a real scheduled run and an alert before expanding.
Monitor one scheduled task free5 monitors free · No credit card · Verify one real scheduled run