Skip to content

Windows Task Scheduler

Wrap your task in a small PowerShell script that pings only after the work succeeds.

PowerShell wrapper

Create run-job.ps1:

Terminal window
$PingUrl = $env:DMJR_PING_URL # or paste your monitor's URL directly
# ... do the work ...
& "C:\Scripts\nightly-job.exe"
if ($LASTEXITCODE -eq 0) {
Invoke-RestMethod -Uri $PingUrl -TimeoutSec 10
} else {
Write-Error "Job failed with exit code $LASTEXITCODE — skipping ping."
exit $LASTEXITCODE
}

The ping (Invoke-RestMethod) runs only when the job exited 0. If the job fails, no ping is sent and you get alerted.

Schedule it

Point a Task Scheduler action at the script:

  • Program/script: powershell.exe
  • Add arguments: -ExecutionPolicy Bypass -File "C:\Scripts\run-job.ps1"

Copy the ping URL from your monitor on the dashboard. Set the monitor’s period to match the task’s trigger and add some grace for late starts.

On Windows 10/11 and Server 2019+ you can also use curl.exe -fsS %DMJR_PING_URL% in a batch wrapper — note the .exe, since bare curl in PowerShell is an alias for Invoke-WebRequest.