PowerShell script exchange
Post Reply
fgoosen
Service Provider
Posts: 8
Liked: never
Joined: May 25, 2018 5:19 pm
Full Name: Francois Goosen
Contact:

Get-VBRJobObject returning null on some copy jobs

Post by fgoosen »

Hi all,

When trying to grab the objects from copy jobs with the line below, some jobs are returning null. I've tested on two servers, with the similar results. All affected jobs are Endpoint copy jobs.

Code: Select all

Get-VbrJob -Name "Job Name" | Get-VbrJobObject
Both servers are on Server 2016 Std, with 9.5 u3a.

Thank you,
Francois
DGrinev
Veteran
Posts: 1943
Liked: 247 times
Joined: Dec 01, 2016 3:49 pm
Full Name: Dmitry Grinev
Location: St.Petersburg
Contact:

Re: Get-VBRJobObject returning null on some copy jobs

Post by DGrinev »

Hi Francois and welcome to the community!

Can you clarify by Endpoint copy jobs you mean Backup copy jobs with the Agent backups as source? Thanks!
fgoosen
Service Provider
Posts: 8
Liked: never
Joined: May 25, 2018 5:19 pm
Full Name: Francois Goosen
Contact:

Re: Get-VBRJobObject returning null on some copy jobs

Post by fgoosen »

Thanks, DGrinev!

Yes, that is correct. Backup copy jobs, with Agent backups as the source.

I may have found a clue: The copy jobs that have the null objects, all have the Agent backup jobs added under "Objects", where the others have the agents added directly ("Add > from Jobs" vs "Add > from Backups").

Is there perhaps a different way to access the objects added using "Add > from Jobs"?

Thank you,
Francois
DGrinev
Veteran
Posts: 1943
Liked: 247 times
Joined: Dec 01, 2016 3:49 pm
Full Name: Dmitry Grinev
Location: St.Petersburg
Contact:

Re: Get-VBRJobObject returning null on some copy jobs

Post by DGrinev »

You're right, since only backups added as a source for the backup copy job can be retrieved as Objects through Powershell.

There is no way to get the objects from Jobs by using Powershell cmdlets. Thanks!
fgoosen
Service Provider
Posts: 8
Liked: never
Joined: May 25, 2018 5:19 pm
Full Name: Francois Goosen
Contact:

Re: Get-VBRJobObject returning null on some copy jobs

Post by fgoosen »

Thank you for the confirmation.

Do you know whether adding the backup and removing the job would cause Veeam to see it as a whole new object?
Vek17
Service Provider
Posts: 49
Liked: 15 times
Joined: May 29, 2018 8:42 pm
Contact:

Re: Get-VBRJobObject returning null on some copy jobs

Post by Vek17 »

This is how I grab this data in my environment:

Code: Select all

$Job = Get-VbrJob -Name 'LPAO VAW BackupCopy'
$Objects = $(
	foreach ($Id in $Job.LinkedJobIds.Guid){
                ([Veeam.Backup.Core.CBackupJob]::GetAll()| Where-Object {$_.id -eq $Id}).getObjectsInJob()
    	}
)
It is required that you use [Veeam.Backup.Core.CBackupJob]::GetAll() instead of Get-VBRJob here as Get-VBRJob does not return agents
fgoosen
Service Provider
Posts: 8
Liked: never
Joined: May 25, 2018 5:19 pm
Full Name: Francois Goosen
Contact:

Re: Get-VBRJobObject returning null on some copy jobs

Post by fgoosen »

Great, that worked perfectly! Thanks a ton for help, Vek17.
lroscoe
Influencer
Posts: 14
Liked: 1 time
Joined: May 17, 2017 4:55 pm
Full Name: Leo Roscoe
Contact:

Re: Get-VBRJobObject returning null on some copy jobs

Post by lroscoe »

Where did you have to add it in the script for it to work?
veremin
Product Manager
Posts: 20413
Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get-VBRJobObject returning null on some copy jobs

Post by veremin »

You need to just replace a name of the job in the first line of the script provided by Vek17. Or you're after listing objects of all backup copy jobs you have (regardless of how those objects are added to them: either as backups or as backup jobs)? Thanks!
lroscoe
Influencer
Posts: 14
Liked: 1 time
Joined: May 17, 2017 4:55 pm
Full Name: Leo Roscoe
Contact:

Re: Get-VBRJobObject returning null on some copy jobs

Post by lroscoe »

Thanks! I was asking where do I need to add this in the my veeam report script?

$Job = Get-VbrJob -Name 'LPAO VAW BackupCopy'
$Objects = $(
foreach ($Id in $Job.LinkedJobIds.Guid){
([Veeam.Backup.Core.CBackupJob]::GetAll()| Where-Object {$_.id -eq $Id}).getObjectsInJob()
}
)
jhoughes
Veeam Vanguard
Posts: 282
Liked: 113 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: Get-VBRJobObject returning null on some copy jobs

Post by jhoughes »

That snippet of code would only return objects within a specific job (named in the first line).

The MyVeeamReport script is not written such that this could easily be copied in and gather all the same results.
Husband, Father, Solutions Architect, Geek | @DenverVMUG & @DenverPSUG leader | International Speaker | Veeam Vanguard | vExpert (PRO) | Cisco Champion
Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests