This is a backup job in VBR. Its a workstation backup managed by an agent.
I would like to know last time it was backed up and if it was successful, using powershell.
The issue is that if we look at history, we see not just backup runs, but also policies updates.
And using now recommended VBRComputerBackupJob and VBRComputerBackupJobSession I seem unable to find a way to distinguish between these two sessions types.
But I need to filter out policy runs as they can be successful while the actual backups of data could be failing.
This is just code I am testing stuff with.
Code: Select all
$AgentJobs = @(Get-VBRComputerBackupJob)
#$AgentJobs
foreach ($Job in $AgentJobs) {
#$job
$Job.Name
$Job.GetType().Name
$Job.Id.Guid
"----------------------"
$JobSessions = @(Get-VBRComputerBackupJobSession | where {$_.JobId -eq $job.Id})
foreach ($session in $JobSessions) {
$session
}
}