I searching for a script sample to monitor the continuous backup copy job status.
I want to report the succes, warning or failed status. I am not very aware about scripting so be cool with me.

Thanks.
Zed!
Code: Select all
asnp VeeamPSSNapin
$Job = Get-VBRJob -name "Name of backup copy Job"
$LastSession = $Job.FindLastSession()
$LastSession.State
This is by design. The FindLastSession method returns the latest session, not the last finished one.I think it would be better to change the method FindLastSession so that it displays the information of the latest finished session, not the currently running (idle state) session, or is there another way to achieve this?
Code: Select all
$Session = Get-VBRBackupSession | ? {$_.jobname -eq $Job.Name} | sort {$_.CreationTime} -Descending | select -first 2 | select -Last 1
$Session.Result
Code: Select all
$Sessions = Get-VBRBackupSession
$BackupCopySessionsLast = $Sessions | Where {$_.Jobtype -eq "BackupSync"} |Group-Object JobId | ForEach-Object {$_.Group | Sort-Object CreationTime -Descending | Select -First 1 }| Select *
ForEach($Job in $BackupCopyActiveJobs){
$EndTime = ($BackupCopySessionsLast | Where {$_.JobId -eq $Job.Id}).EndTime
If($EndTime -ne "01/01/1900"){
# Command to get the statuses of individual tasks (VMs) in the backup Copy Job
}
}
Code: Select all
$Sessions = Get-VBRBackupSession
$BackupCopySessionsLast = $Sessions | Where {$_.Jobtype -eq "BackupSync"} |Group-Object JobId | ForEach-Object {$_.Group | Sort-Object CreationTime -Descending | Select -First 1 }| Select *
ForEach($Job in $BackupCopyActiveJobs){
$EndTime = ($BackupCopySessionsLast | Where {$_.JobId -eq $Job.Id}).EndTime
If($EndTime -ne "01/01/1900"){
foreach($Task in $Job.GetTaskSessions()){
#Do Per VM Stuff
}
}
}
Code: Select all
Asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of your backup copy job"
$Session = $Job.FindLastSession()
$Session.GetTaskSessions() | where {$_.Status -eq "Success"} | select Name
Users browsing this forum: No registered users and 29 guests