PowerShell script exchange
Post Reply
siranee.ja
Enthusiast
Posts: 29
Liked: 5 times
Joined: Mar 11, 2019 1:13 am
Contact:

How can I get the history data for Backup Copy Job?

Post by siranee.ja »

Hi Everyone,

I use VBR version 12.1.1.56
How can I get the history data for Backup Copy Job?
I can see all history data from history view of the VBR console.

This snippet get only last session of the job.
$job = Get-VBRJob -Name "Backup Copy Job 1"
$session = Get-VBRSession -Job $job


I want to get the previous data of this Backup Copy Job including specific date time to get them.

Best Regards,
Siranee Jaraswachirakul
david.domask
Veeam Software
Posts: 3227
Liked: 751 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: How can I get the history data for Backup Copy Job?

Post by david.domask »

Hi Siranee,

v12 (and currently in v13) we still have some work to do with Backup Copy and the session reporting due to some differences in how Immediate Copy sessions are handled internally.

For now, please do the following; understand that Backup Copies are a parent job that has worker jobs underneath for each machine in the Backup Copy job. Assume there was only one machine in a Backup Copy Job for example:

Code: Select all

$bcJob = Get-VBRBackupCopyJob
$convJob = Get-VBRJob | Where-Object {$_.Id -eq $bcJob.id}
$workerJobs = $convJob.GetWorkerJobs()
[Veeam.Backup.Core.CBackupSession]::GetByJob($workerJobs[0].id)
Fetch it that way. If you need to report on multiple machines, loop over the $workerJobs array and pull the data out you need.
David Domask | Product Management: Principal Analyst
siranee.ja
Enthusiast
Posts: 29
Liked: 5 times
Joined: Mar 11, 2019 1:13 am
Contact:

Re: How can I get the history data for Backup Copy Job?

Post by siranee.ja »

Hi David,
Thank you for your fast reply.
After I tested run the result below:

[Veeam.Backup.Core.CBackupSession]::GetByJob($workerJobs[0])
Cannot convert argument "jobId", with value: "Veeam.Backup.Core.CBackupJob", for
"GetByJob" to type "System.Guid": "Cannot convert the "Veeam.Backup.Core.CBackupJob"
value of type "Veeam.Backup.Core.CBackupJob" to type "System.Guid"."
At line:4 char:1
+ [Veeam.Backup.Core.CBackupSession]::GetByJob($workerJobs[0])
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Best Regards,
david.domask
Veeam Software
Posts: 3227
Liked: 751 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: How can I get the history data for Backup Copy Job?

Post by david.domask »

Ah, apologies, I had a typo (fixed now)

[Veeam.Backup.Core.CBackupSession]::GetByJob($workerJobs[0].id)

GetByJob() method accepts a GUID as argument, I forgot to include the call for id
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 256 guests