PowerShell - Get error/warning message of failed VM's in SureBackup Veeam

455 Views Asked by At

I'm trying to use this function Get-VSBSession to get error message of failed VM's in SureBackup.

This is my script:

$vbrsessions = Get-VSBSession | ?{$_.result -ne "success"}
foreach ($session in $vbrsessions)
{ 
    foreach ($failedVM in $session.GetTaskSessionsByResult(("failed")))
   {
       Write-Host "Job Name:" $failedVM.JobName
       Write-Host "Status:" $FailedVM.Info.Result 
       Write-Host "VM:" $failedVM.Name
       Write-Host "Error:" ???
   }
} 

What is the command to get the error message?

Thanks

1

There are 1 best solutions below

0
On
$vbrsessions = Get-VSBSession | ?{$_.result -ne "success"}
foreach ($session in $vbrsessions)
{ 
    foreach ($failedVM in $session.GetTaskSessionsByResult(("failed")))
   {
       Write-Host "Job Name:" $failedVM.JobName
       Write-Host "Status:" $FailedVM.Info.Result 
       Write-Host "VM:" $failedVM.Name
       Write-Host "Error: $(($failedVM.Logger.GetLog().UpdatedRecords | where Status -ne "ESucceeded" | select -ExpandProperty Title) -join ", ")"
   }
}