There was one script requirement from one of our clients based on the Altaro Physical Backup Software product and they needed an event base script out of it as below.
Event ID 5100 – Successful Backup event
Event ID 5101 – Warning Backup event Event ID 5102 – Failed Backup eventScript should look back X number of days and if the backup event found is 5100, it’s should show successful and if it shows 5101 or 5102 – it should display an error.
He wanted the Output as below: 5100 = Backup erfolgreich 5101 = Backup fehlerhaft 5102 = Backup fehlerhaftIf the backup event is successful, the output will be 0. If it has failed, shows a warning or if no event is found, it will give us 1001.
Syntax
#param([Int32]$days)
if($days -ne $null -and $days -ne ”){
$success_5100 = Get-EventLog -LogName Application -InstanceId 5100 -Source “Altaro Physical Server Backup” -After (Get-Date).AddHours(-24*$days) -erroraction silentlycontinue
$line = $success_5100 | measure-object -line
Purpose: | Weekly Maintenance of a single device or all devices in the domain |
Modification: | The user can modify the number of days |
Type: | PowerShell (.ps1) |
Compatibility: | Run with PowerShell |
Tags: | altaro physical backup software, backup status |
Reference link: |