<# .SYNOPSIS Universal MonitorSpider backup ping - bolt a watchdog onto ANY existing backup tool (Cobian, Veeam post-job, wbadmin wrapper, robocopy script...). .DESCRIPTION Call it after your backup finishes, e.g. from a scheduled task, a post-backup event, or the end of your own script: # success (with optional size/duration/label): .\Send-BackupPing.ps1 -PingUrl $url -Status success -Bytes 10737418240 -DurationS 900 # failure: .\Send-BackupPing.ps1 -PingUrl $url -Status fail -Message "job exited 2" # or wrap a whole job in one line: & .\my-backup.ps1; .\Send-BackupPing.ps1 -PingUrl $url -Status $(if ($?) {'success'} else {'fail'}) Create the ping URL by adding a "Backup (push)" monitor at https://monitorspider.com/dashboard/ - you'll be alerted when the job reports a failure and, more importantly, when it silently stops pinging. From https://monitorspider.com/backup-kits/ - MIT licensed. #> param( [Parameter(Mandatory)][string]$PingUrl, [ValidateSet('success', 'fail', 'start')][string]$Status = 'success', [string]$Message = '', [long]$Bytes = -1, [int]$DurationS = -1, [string]$SetName = '' ) [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $body = @{ status = $Status } if ($SetName) { $body.set = $SetName } if ($Message) { $body.message = $Message } if ($Bytes -ge 0) { $body.bytes = $Bytes } if ($DurationS -ge 0) { $body.duration_s = $DurationS } Invoke-RestMethod -Method Post -Uri $PingUrl -ContentType 'application/json' ` -Body ($body | ConvertTo-Json) -TimeoutSec 30 | Out-Null Write-Host "MonitorSpider ping sent: $Status"