Send check-ins from Windows Task Scheduler
Run a PowerShell backup through Windows Task Scheduler and report its success or failure to BotPings. Verify alerts from your scheduled job on iPhone.
Windows · PowerShell · 3 min · Servers and scripts
Before you start
Create a check-in in BotPings. Use the same Windows account for the task and the test. Set BOTPINGS_CHECK_IN_URL for that account and restart the shell before testing.
Steps
Wrap the script
Save this as C:/Jobs/backup-and-check-in.ps1. Replace C:/Jobs/backup.ps1 with your validated job. The job should exit nonzero on failure. Use powershell.exe instead of pwsh.exe throughout if the job requires Windows PowerShell.
& pwsh.exe -NoProfile -File C:/Jobs/backup.ps1
$jobStatus = $LASTEXITCODE
$url = $env:BOTPINGS_CHECK_IN_URL
if (-not $url) { throw "Missing check-in URL" }
if ($jobStatus -eq 0) {
Invoke-WebRequest -UseBasicParsing -TimeoutSec 15 -Uri $url | Out-Null
} else {
try { Invoke-WebRequest -UseBasicParsing -TimeoutSec 15 -Uri "$url/fail" | Out-Null }
finally { exit $jobStatus }
}Set the task action
In Task Scheduler, create the task under the intended Windows account. Choose Start a program and set the program to the path of pwsh.exe. Use -NoProfile -File "C:/Jobs/backup-and-check-in.ps1" as arguments.
Run it manually
Choose Run in Task Scheduler, then check Last Run Result. You can use curl.exe --fail --silent --show-error "$env:BOTPINGS_CHECK_IN_URL" to troubleshoot the success URL from PowerShell.
Test it
Confirm that Last check-in updates after a successful run. Test a nonzero exit in a disposable job and check for a failure alert.
If it doesn’t work
- The interactive shell works but the task does not. Check the task user, executable path and environment.
- Last Run Result shows failure. Check the wrapped job first, then the HTTP request.
- The successful job did not check in. Verify the private URL and network access from the task account.
Related guides
PowerShell syntax checked locally, November 2026. Run the Task Scheduler test on your Windows host.