PRTG PowerShell Script for Windows Server Backups

17 Mar

Just a quick post on a custom PRTG PowerShell script for monitoring the status of Windows Server backups.

Using the page her as a reference, I cut it right down just to return 0 if all is OK and 1 if there is an issue with the most recent backup. there is plenty of scope to improve this going forward.

$DEVICE=$args[0]
$BackupStatus = Invoke-Command -Computername $DEVICE -ScriptBlock { add-Pssnapin Windows.serverbackup; Get-WBSummary }

$errorcode = $BackupStatus|Select-Object -ExpandProperty LastBackupResultHR

if($errorcode -ge 0){
    return "Error:1"
}else{
    return "OK:0"
}

References: