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.
Article Comments
Attention: This article is a record of a conversation with the Paessler support team. The information in this conversation is not updated to preserve the historical record. As a result, some of the information or recommendations in this conversation might be out of date.
Hi there,
Should have included the link in the first post, but here it is:
Script-World
Best regards.
Aug, 2017 - Permalink
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.
Aug, 2017 - Permalink