What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Windows Backup Sensor Custom Exe

Votes:

0

I want to address a fix to a problem that a lot of people have been having and that I couldn't find a proper solution to here in the knowledge base. Below is a script that is working in the 17.2.30.1883 version. I did not write the whole script myself but put a couple different scripts together and tweaked it until it was working correctly. Hopefully this saves someone a headache as I worked for days without a solution. Enjoy!

param([string]$hostname = "your server name")

Invoke-Command -ComputerName $hostname{
$today=(Get-Date)
$dateshift=(Get-Date).AddHours(-12)
$EventError=Get-WinEvent -LogName Microsoft-Windows-Backup| Where-Object {$_.TimeCreated -gt $dateshift} | Where-Object {$_.LevelDisplayName -eq "Error"}
$EventWarning=Get-WinEvent -LogName Microsoft-Windows-Backup| Where-Object {$_.TimeCreated -gt $dateshift} | Where-Object {$_.LevelDisplayName -eq "Warning"}
$EventOK=Get-WinEvent -LogName Microsoft-Windows-Backup| Where-Object {$_.TimeCreated -gt $dateshift} | Where-Object {$_.LevelDisplayName -eq "Information"}

$backupsets=Get-WBBackupSet
$lastbackup=(Get-Date)-($backupsets.BackupTime |Measure-Object -Maximum |Select-Object -ExpandProperty Maximum)
$lastbkround=[math]::Floor($lastbackup.TotalHours)

$x = [string] $($EventError.Count)+":OK"
Write-Host $x

Exit 0

You can tweak the time that it searches for an error under the $dateshift, other than that it is pretty straight forward. Let me know if you have any questions, recommendations, critiques or anything at all. Thanks.

custom-exe custom-sensor event-logs windows-backup

Created on Aug 2, 2017 3:09:26 AM



3 Replies

Votes:

0

Hi there,

Thank you for sharing, if it is okay for you, I will put this in our script-world so more people are able to find it. :)

Best regards.

Created on Aug 4, 2017 5:58:04 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

Yes thank you! I was unware of the script-world, could you link me to it?

Created on Aug 9, 2017 1:36:22 PM



Votes:

0

Hi there,

Should have included the link in the first post, but here it is:
Script-World

Best regards.

Created on Aug 9, 2017 2:43:59 PM by  Dariusz Gorka [Paessler Support]

Last change on Aug 9, 2017 2:44:16 PM by  Dariusz Gorka [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.