-
siranee.ja
- Enthusiast
- Posts: 33
- Liked: 6 times
- Joined: Mar 11, 2019 1:13 am
- Contact:
How can I get the history data for Backup Copy Job?
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
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: 3235
- Liked: 751 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: How can I get the history data for Backup Copy Job?
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:
Fetch it that way. If you need to report on multiple machines, loop over the $workerJobs array and pull the data out you need.
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)
David Domask | Product Management: Principal Analyst
-
siranee.ja
- Enthusiast
- Posts: 33
- Liked: 6 times
- Joined: Mar 11, 2019 1:13 am
- Contact:
Re: How can I get the history data for Backup Copy Job?
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,
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: 3235
- Liked: 751 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: How can I get the history data for Backup Copy Job?
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
[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
-
siranee.ja
- Enthusiast
- Posts: 33
- Liked: 6 times
- Joined: Mar 11, 2019 1:13 am
- Contact:
Re: How can I get the history data for Backup Copy Job?
Hi David,
Thank you for the code.
If I want more detail about the worker job, what should I do?
$backup_start_beg="01/14/2026 00:00 AM";
$backup_start_end="01/15/2026 00:00 AM";
$bcJob = Get-VBRBackupCopyJob -Name "Backup Copy all to veeamrepo_nas"
$convJob = Get-VBRJob | Where-Object {($_.Id -eq $bcJob.id)}
$workerJobs = $convJob.GetWorkerJobs()
[Veeam.Backup.Core.CBackupSession]::GetByJob($workerJobs[0].Id)| Where {($_.CreationTime -gt "$backup_start_beg" -and $_.CreationTime -lt "$backup_start_end")}
The result of the script above:
Job Name State Start Time End Time Result
-------- ----- ---------- -------- ------
Backup Copy all t... Stopped 1/14/2026 8:10:05 AM 1/14/2026 8:18:39 AM Success
I want to get more detail such as transfer bytes , etc.
Best Regards,
Thank you for the code.
If I want more detail about the worker job, what should I do?
$backup_start_beg="01/14/2026 00:00 AM";
$backup_start_end="01/15/2026 00:00 AM";
$bcJob = Get-VBRBackupCopyJob -Name "Backup Copy all to veeamrepo_nas"
$convJob = Get-VBRJob | Where-Object {($_.Id -eq $bcJob.id)}
$workerJobs = $convJob.GetWorkerJobs()
[Veeam.Backup.Core.CBackupSession]::GetByJob($workerJobs[0].Id)| Where {($_.CreationTime -gt "$backup_start_beg" -and $_.CreationTime -lt "$backup_start_end")}
The result of the script above:
Job Name State Start Time End Time Result
-------- ----- ---------- -------- ------
Backup Copy all t... Stopped 1/14/2026 8:10:05 AM 1/14/2026 8:18:39 AM Success
I want to get more detail such as transfer bytes , etc.
Best Regards,
-
siranee.ja
- Enthusiast
- Posts: 33
- Liked: 6 times
- Joined: Mar 11, 2019 1:13 am
- Contact:
Re: How can I get the history data for Backup Copy Job?
Hi David,
I think the answer for my question is below.
$backup_start_beg="01/14/2026 00:00 AM";
$backup_start_end="01/15/2026 00:00 AM";
$bcJob = Get-VBRBackupCopyJob -Name "Backup Copy all to veeamrepo_nas"
$convJob = Get-VBRJob | Where-Object {($_.Id -eq $bcJob.id)}
$workerJobs = $convJob.GetWorkerJobs()
$session=[Veeam.Backup.Core.CBackupSession]::GetByJob($workerJobs[0].Id)| Where {($_.CreationTime -gt "$backup_start_beg" -and $_.CreationTime -lt "$backup_start_end")}
echo $session.info
But I still have question. This jobs have more than one vm to do. If some vm failed and some vm success or the job has warning, Should it show on the $session.info or how can I get the detail of each vm?
Best Regards,
I think the answer for my question is below.
$backup_start_beg="01/14/2026 00:00 AM";
$backup_start_end="01/15/2026 00:00 AM";
$bcJob = Get-VBRBackupCopyJob -Name "Backup Copy all to veeamrepo_nas"
$convJob = Get-VBRJob | Where-Object {($_.Id -eq $bcJob.id)}
$workerJobs = $convJob.GetWorkerJobs()
$session=[Veeam.Backup.Core.CBackupSession]::GetByJob($workerJobs[0].Id)| Where {($_.CreationTime -gt "$backup_start_beg" -and $_.CreationTime -lt "$backup_start_end")}
echo $session.info
But I still have question. This jobs have more than one vm to do. If some vm failed and some vm success or the job has warning, Should it show on the $session.info or how can I get the detail of each vm?
Best Regards,
-
david.domask
- Veeam Software
- Posts: 3235
- Liked: 751 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: How can I get the history data for Backup Copy Job?
Glad that you were able to get it functioning.
The info you want is returned by Get-VBRTaskSession with the -Session parameter. Pass the object you get from [Veeam.Backup.Core.CBackupSession] to Get-VBRTaskSession -Session $session
That will return the info you want, I don't remember off the top of my head which property on the Task Session object has it but I think it's under AuxData or Progress.
The info you want is returned by Get-VBRTaskSession with the -Session parameter. Pass the object you get from [Veeam.Backup.Core.CBackupSession] to Get-VBRTaskSession -Session $session
That will return the info you want, I don't remember off the top of my head which property on the Task Session object has it but I think it's under AuxData or Progress.
David Domask | Product Management: Principal Analyst
-
siranee.ja
- Enthusiast
- Posts: 33
- Liked: 6 times
- Joined: Mar 11, 2019 1:13 am
- Contact:
Re: How can I get the history data for Backup Copy Job?
Hi David,
with Get-VBRTaskSession -Session $session
It return only one vm. I wish it should return the list of all vms.
Do you have other methods?
Best Regards,
with Get-VBRTaskSession -Session $session
It return only one vm. I wish it should return the list of all vms.
Do you have other methods?
Best Regards,
-
david.domask
- Veeam Software
- Posts: 3235
- Liked: 751 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: How can I get the history data for Backup Copy Job?
Each VM is tracked in a worker job beneath the main job -- so once you get the worker jobs with GetWorkerJobs(), you need to iterate over those results to get each machine in the Backup Copy.
I know this is not ideal right now, and as noted I know that there were plans to make this more graceful, but use the method we discussed here for the time being.
I know this is not ideal right now, and as noted I know that there were plans to make this more graceful, but use the method we discussed here for the time being.
David Domask | Product Management: Principal Analyst
-
siranee.ja
- Enthusiast
- Posts: 33
- Liked: 6 times
- Joined: Mar 11, 2019 1:13 am
- Contact:
Re: How can I get the history data for Backup Copy Job?
Hi David,
Thank you every much for the answer. I've got all info that I want right now.
Best Regards,
Thank you every much for the answer. I've got all info that I want right now.
Best Regards,
Who is online
Users browsing this forum: andrei.pascu and 104 guests