PowerShell script exchange
Post Reply
apolloxm
Enthusiast
Posts: 78
Liked: 1 time
Joined: Aug 27, 2021 12:29 am
Contact:

how to get backup and backup copy jobs duration

Post by apolloxm »

Hello,

Currently I am running below command to get information as following, How I can get more information, like job duration,start time, end time etc.I want to know how long each job took. Can you help me about this?Thanks

Code: Select all

(Get-VBRBackup |Get-VBRRestorePoint) |Select-Object vmname,type,creationtime, @{N="Job"; E={$_.getsourcejob().name }}, 
@{N="Repo"; E={$_.getrepository().name }},@{N="Backupsize"; E={$_.getstorage().stats.BackupSize }}, 
@{N="DataSize"; E={$_.getstorage().stats.datasize }}  | ft -autosize |out-file c:\temp\size.txt
david.domask
VeeaMVP
Posts: 1011
Liked: 276 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: how to get backup and backup copy jobs duration

Post by david.domask »

Hi @apolloxm,

Job Duration/Start Time/End Time are Session Objects, and you'll want to pass your Jobs returned by Get-VBRJob/Get-VBRComputerBackupJob to Get-VBRSession: https://helpcenter.veeam.com/docs/backu ... ml?ver=110

Try playing with that a bit and see what you can find. The start time will be listed as a property CreationTime (might be CreationTimeUTC), the end time will be self-explanatory property.
David Domask | Director: Customer Care | Veeam Technical Support
apolloxm
Enthusiast
Posts: 78
Liked: 1 time
Joined: Aug 27, 2021 12:29 am
Contact:

Re: how to get backup and backup copy jobs duration

Post by apolloxm »

Hello,

Is it possible to get the jobs duration via my script? I don't want to get that via the new script
david.domask
VeeaMVP
Posts: 1011
Liked: 276 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: how to get backup and backup copy jobs duration

Post by david.domask »

Hi @apolloxm, RestorePoint objects don't contain session data, so you will need to write additional code into your script to get the session data.

I recommend start with Get-VBRBackup as your entry point, and from there with CBackup Objects you can use the GetJob() method to get the job, and then pass the CBackup object to Get-VBRRestorepoints.
David Domask | Director: Customer Care | Veeam Technical Support
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests