PowerShell script exchange
Post Reply
DanielJ
Service Provider
Posts: 200
Liked: 32 times
Joined: Jun 10, 2019 12:19 pm
Full Name: Daniel Johansson
Contact:

GetChildJobs() gone in v11

Post by DanielJ »

>> $job = Get-VBRComputerBackupJob -Name "Linux agents"
>> $job.GetChildJobs()
> Method invocation failed because [Veeam.Backup.PowerShell.Infos.VBRComputerBackupJob] does not contain a method named 'GetChildJobs'.

GetChildJobs() seems to have been removed. What is the new way to access child jobs created by agent jobs?
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: GetChildJobs() gone in v11

Post by oleg.feoktistov »

Hi Daniel,

To be precise, GetChildJobs() method has never been in VBRComputerBackupJob class. This class is related to the fixed Powershell API and has no public static methods besides common ones. As far as I see, GetChildJobs() was removed from CBackupJob class in v10, for which I don't know the reason. But it was never supported anyway.

Could you tell me please what are you trying to achieve? It looks like you may find GetWorkerJobs() or FindChildJobs() method in CBackupJob class fitting (instantiated with Get-VBRJob cmdlet).

Thanks,
Oleg
DanielJ
Service Provider
Posts: 200
Liked: 32 times
Joined: Jun 10, 2019 12:19 pm
Full Name: Daniel Johansson
Contact:

Re: GetChildJobs() gone in v11

Post by DanielJ »

I want to list all servers in the backups of a job (of any type). If the job is an agent job, I have done like this:

Code: Select all

$oibs = $backup.GetOibs()
if (!$oibs.Count) { $oibs = $job.GetChildJobs().GetLastBackup().GetOibs()
I was never able to find out why $backup.GetOibs() return nothing for some agent backups, but I found that I in those cases can find the objects in backup with the workaround seen above. This has worked fine up to v10a. Now in v11 I need to rewrite it. I will look at the methods you suggested.
DanielJ
Service Provider
Posts: 200
Liked: 32 times
Joined: Jun 10, 2019 12:19 pm
Full Name: Daniel Johansson
Contact:

Re: GetChildJobs() gone in v11

Post by DanielJ »

Oh, and an addition. $job was set like this in the script:

Code: Select all

$job = [Veeam.Backup.Core.CBackupJob]::GetAll()|?{$_.Name -eq $param_jobname}
in order to get the job regardless of job type. Now as I tested it at the prompt I used Get-VBRComputerBackupJob since I already knew it is an agent job.
DanielJ
Service Provider
Posts: 200
Liked: 32 times
Joined: Jun 10, 2019 12:19 pm
Full Name: Daniel Johansson
Contact:

Re: GetChildJobs() gone in v11

Post by DanielJ »

It was as easy as replacing GetChildJobs() with FindChildJobs(). Somehow I missed it when I tabbed through all available methods. Thanks!
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: GetChildJobs() gone in v11

Post by oleg.feoktistov »

Glad you could figure it out. Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests