Hi James,
On backup import we add information about the backup, but the corresponding job is not being imported along the way.
You can visualize what I mean by looking at JobId property of an imported backup:
Code: Select all
PS C:\Windows\system32> $backup = Get-VBRBackup -Name 'Backup to SOBR Cloud'
$backup | select Name, JobId, JobName
Name JobId JobName
---- ----- -------
Backup to SOBR Cloud 00000000-0000-0000-0000-000000000000 Backup to SOBR Cloud
As you can see, JobId is zeroed because the associated job is not registered in a new VBR.
So, in your first approach there is just nothing to return starting with Get-VBRJob cmdlet.
In your second approach you invoke GetObjects() on a backup instance. We have information about the imported backups, so we can find the objects this backup includes.
P.S. For your variables I would advise using names relevant to the object types and cmdlets you are dealing with to avoid confusion:
$backups for Get-VBRBackup, $backupJobs for Get-VBRJob etc. I think, using $BackupJobs for Get-VBRBackup and $JobName for a single backup instance tempts you to refer to jobs, not backups. Especially, when a script is huge and you can't always keep track of all the entities.
Thanks,
Oleg