Wrote this script to check Veeam Backup Copy Jobs
My issue is I can not get the LastResult to display properly
$name = $args[0]
if ((Get-PSSnapin -Name VeeamPSSNapin -ErrorAction SilentlyContinue) -eq $null)
{
Add-PSSnapin VeeamPSSNapin
}
$JobNames = Get-VBRJob -Name $name
foreach ($JobName in $JobNames) {
$Job = Get-VBRJob -name $JobName.Name
$LastSession = $Job.FindLastSession()
$Name = $Job.Name
$Status = $LastSession.State
$Progress = "$($LastSession.BaseProgress)%"
$LastResult = Get-VBRBackupSession | Where {$_.jobId -eq $job.Id.Guid} | Sort EndTimeUTC -Descending | Select -First 1 result
}
write-host $Name $Status $Progress $LastResult
exit 0 #success
When I run this script this is my results
PS C:\program files\nsclient++\scripts\powershell> .\check_veeam_backups.ps1 “cucm_storeonce-backupcopy”
CUCM_StoreOnce-BackupCopy Idle 33% @{Result=Success}
I would like to see
CUCM_StoreOnce-BackupCopy Idle 33% Success
Any ideas?
Thank you
Tom