In my report script, I want to list backup stats per agent in an agent management job. The method below worked at least in 11a and maybe in 12 (Not sure because the VBR server I run most scripts from was upgraded directly from 11a to 12.1). This no longer works, the $backup array remains empty. I can find all the backup files using GetAllChildrenStorages() on the agent management job, but right now I can't see an easy method to separate these into one collection of backup files per agent. The only obvious way I see is to check the beginning of PartialPath, which is very kludgy.
Code: Select all
$allbackups = Get-VBRBackup
$alljobs = [Veeam.Backup.Core.CBackupJob]::GetAll()
$job = $alljobs|?{$_.Name -eq 'Name of the agent management job'}
$backup = @()
$childjobs = $job.FindChildJobs()
foreach ($childjob in $childjobs) {
$backup += $allbackups|?{$_.JobId -eq $childjob.Id}
}
Footnote: I use the method shown to get $job just to avoid the warning that Get-VBRJob is deprecated for agent jobs, and to use Get-VBRComputerBackupJob instead, but a job returned by that method does not have a FindChildJobs() method.