PowerShell script exchange
Post Reply
fgoosen
Service Provider
Posts: 4
Liked: never
Joined: May 25, 2018 5:19 pm
Contact:

Get-VBRJobObject returning null on some copy jobs

Post by fgoosen » Feb 28, 2019 10:30 pm

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
Veeam Software
Posts: 1739
Liked: 221 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 » Mar 01, 2019 2:31 pm

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: 4
Liked: never
Joined: May 25, 2018 5:19 pm
Contact:

Re: Get-VBRJobObject returning null on some copy jobs

Post by fgoosen » Mar 01, 2019 2:44 pm

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
Veeam Software
Posts: 1739
Liked: 221 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 » Mar 01, 2019 3:10 pm

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: 4
Liked: never
Joined: May 25, 2018 5:19 pm
Contact:

Re: Get-VBRJobObject returning null on some copy jobs

Post by fgoosen » Mar 01, 2019 5:15 pm

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: 41
Liked: 11 times
Joined: May 29, 2018 8:42 pm
Contact:

Re: Get-VBRJobObject returning null on some copy jobs

Post by Vek17 » Mar 01, 2019 8:00 pm

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: 4
Liked: never
Joined: May 25, 2018 5:19 pm
Contact:

Re: Get-VBRJobObject returning null on some copy jobs

Post by fgoosen » Mar 03, 2019 10:04 pm

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 » Jun 17, 2019 4:49 pm

Where did you have to add it in the script for it to work?

veremin
Product Manager
Posts: 16884
Liked: 1433 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 » Jun 17, 2019 5:40 pm

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 » Aug 21, 2019 8:40 pm

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 Software
Posts: 107
Liked: 26 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Austin, TX
Contact:

Re: Get-VBRJobObject returning null on some copy jobs

Post by jhoughes » Aug 21, 2019 9:39 pm

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 Extraordinaire | @AustinVMUG & @ATXPowerShell leader | vExpert | Cisco Champion | Tech Field Day Delegate | VCP 4/5/6 | VCP6-NV | VMware/Cisco UCS/Powershell/VEEAM Enthusiast

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests