PowerShell script exchange
fgoosen
Service Provider
Posts: 8 Liked: never
Joined: May 25, 2018 5:19 pm
Full Name: Francois Goosen
Contact:
Post
by fgoosen » Feb 28, 2019 10:30 pm
this post
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:
Post
by DGrinev » Mar 01, 2019 2:31 pm
this post
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:
Post
by fgoosen » Mar 01, 2019 2:44 pm
this post
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:
Post
by DGrinev » Mar 01, 2019 3:10 pm
this post
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:
Post
by fgoosen » Mar 01, 2019 5:15 pm
this post
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:
Post
by Vek17 » Mar 01, 2019 8:00 pm
this post
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:
Post
by fgoosen » Mar 03, 2019 10:04 pm
this post
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:
Post
by lroscoe » Jun 17, 2019 4:49 pm
this post
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:
Post
by veremin » Jun 17, 2019 5:40 pm
this post
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:
Post
by lroscoe » Aug 21, 2019 8:40 pm
this post
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:
Post
by jhoughes » Aug 21, 2019 9:39 pm
this post
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
Users browsing this forum: No registered users and 22 guests