Already found the code to check the last Status with findlastsession/gettasksessions:
Code: Select all
asnp VeeamPSSnapin
$VMName = "Name_of_VM"
$Job = Get-VBRJob -Name "Name_of_Backup_Job"
$Session = $Job.FindLastSession()
$Tasks = $Session.GetTaskSessions()
$Tasks | ?{$_.Name -eq $VMName} | %{write-host $_.Name ":" $_.Status}
Name_of_VM : Failed
Need something like this, but for a specific vm if status is 'failed' - instead of a whole job.
Code: Select all
asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of your job"
If ($job.GetLastresult() -eq "Warning" -or $job.GetLastresult() -eq "Success")
{
Place your commands here that you want to start
} Else {}
Stefan