When you need this
A script works interactively but the overnight export is missing: Task Scheduler uses a different account, working directory or permissions. Local history helps investigate, but cannot alert you when the whole computer is offline. An external monitor expects completion on schedule.
How to connect
- 1
Create a cron monitor with the task schedule, timezone and grace period. For daily runs at 03:00, use 0 3 * * *.
- 2
Save the wrapper below as C:\Jobs\tickwatch-run.ps1. Set your ping URL and job script path. Configure Task Scheduler to launch the wrapper with powershell.exe.
- 3
Enable a monitor runtime limit and alerts. Test a successful run, exit 7 in a test script and a missed run.
Ready-to-use example
Requires Windows PowerShell 5.1 and outbound HTTPS. The job must return a nonzero exit code on failure: an error suppressed inside the job may leave exit code 0. Set the working directory and account permissions in Task Scheduler; keep the ping key private.
$ErrorActionPreference = 'Stop'
$ping = 'https://ping.tickwatch.dev/YOUR_PING_KEY'
$rid = [guid]::NewGuid().ToString()
function Send-Signal([string]$suffix) {
try {
$url = $ping + $suffix + "?rid=$rid"
Invoke-WebRequest -Uri $url -Method Post -UseBasicParsing -TimeoutSec 5 -ErrorAction Stop | Out-Null
} catch { } # A monitoring outage must not stop the job.
}
$code = 1
Send-Signal '/start'
try {
& "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -NonInteractive -File 'C:\Jobs\backup.ps1'
$code = $LASTEXITCODE
} catch {
$code = 1
} finally {
if ($code -eq 0) { Send-Signal '' } else { Send-Signal '/fail' }
}
exit $codepowershell.exe -NoProfile -NonInteractive -File "C:\Jobs\tickwatch-run.ps1"Check before going live
Test under the actual task account without an interactive desktop. A task configured to run only while the user is logged on may miss overnight runs.
Forced termination may skip finally. The /start signal and maximum runtime check cover a missing completion.
Validate the output: export size, existence and storage write. Exit code 0 only confirms what the script reports.
Common questions
What goes in the Program field?
Use the full path to powershell.exe. Put -NoProfile -NonInteractive -File and the wrapper path in the arguments field. Follow your existing script-signing and execution policy.
Does Tickwatch repair Task Scheduler settings?
It reports missing results or failures. Account credentials, permissions and launch conditions must be fixed on the task host.