PowerShell script exchange
Post Reply
petersonal
Novice
Posts: 5
Liked: never
Joined: Apr 20, 2020 10:17 am
Full Name: Peter Brogyanyi
Contact:

Latest run local gives wrong value

Post by petersonal »

Hi all,
I have Veean version 11 (11.0.1.1261) and using powershell command Get-VBRJob get get actual jobs. One job LatestRunLocal attribute value is 2 years old, but the job finishes every day successfully. Why could this happening?
sample I am using:

Code: Select all

  $VeeamJob = get-vbrjob -name "job-name"
  ($VeeamJob.GetScheduleOptions()).LatestRunLocal
The job type is Hyper-V backup copy
The other job (type: hyper-v backup) has valid LatestRunLocal value. Could someone point me what am I doing wrong?
thanks
david.domask
Veeam Software
Posts: 2123
Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Latest run local gives wrong value

Post by david.domask »

Hi @petersonal,

This gets a bit tricky; first, just a reminder that the .NET methods like GetScheduleOptions() are not supported, and part of the reason is for issues like this. In the past we actually raised an issue on this with our RND and they kindly told us the truth that the job time statuses changed the location they store their info in v10 (for oleg and other PMs checking, issue 214048). GetScheduleOptions() and LatestRunLocal in particular pulls from the old location which is only updated if you edit the job and click "Finish", so it's kind of not reliable.

Basically if I remember right, it's just not proper to rely on this value anymore; likely if you edit the job in the UI (don't change anything, just click "Finish") you'll see this value updated.

As a workaround, could you accept using the last session data?

Supported Way (Longer):

Code: Select all

$job = Get-VBRJob -name 'some job'
$Sess = Get-VBRBackupSession -Name $job.name | sort -Property CreationTime -Descending | select -First 1
$Sess.CreationTime #This will be the same value LatestRunLocal used to present
UnSupported way (Faster, probably safe for future but no guarantees)

Code: Select all

$job = Get-VBRJob -name 'some job'
$sess = $job.FindLastSession()
$sess.CreationTime
David Domask | Product Management: Principal Analyst
petersonal
Novice
Posts: 5
Liked: never
Joined: Apr 20, 2020 10:17 am
Full Name: Peter Brogyanyi
Contact:

Re: Latest run local gives wrong value

Post by petersonal »

Hi,
Thank you for the information and the two solutions. Frist I tried the supperted longer way. For me the Get-VBRBackupSession -Name $job.name gets only one random value. So I did Get-VbrBackupSession | where-object {$_.JobName -eq "job name"} and the sort and first one stuff and that way it worked. Also tried the unsupported faster way, thats works too, so thank you.
david.domask
Veeam Software
Posts: 2123
Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Latest run local gives wrong value

Post by david.domask »

Very happy to help! Curious that the listed one didn't work, but your solution of course is quite fine :)
David Domask | Product Management: Principal Analyst
petersonal
Novice
Posts: 5
Liked: never
Joined: Apr 20, 2020 10:17 am
Full Name: Peter Brogyanyi
Contact:

Re: Latest run local gives wrong value

Post by petersonal »

Oh my post was not submitted I got logged out, unfortune.
I ran into a new issue. When the job type is hyper-v backup copy, you can not get the session by name so easily. My goal is to find also the last run time. The nameing follows the following format: "veeam job name\original job" so I did the query: (Get-VBRBackupSession | Where-Object {$_.JobName.StartsWith($name)} which worked in one server, but not getting any results on the other. Where the code is not working even the Get-VBRBackupSession is not displaying the backup copy type job sessions, still the replication console saying the job ran and the result is success in 11 hours ago.
For today I run out of time for testing, but I will post an update in a couple of days, if I find.
david.domask
Veeam Software
Posts: 2123
Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Latest run local gives wrong value

Post by david.domask »

Hi Peter!

Honestly seems a little unexpected.

Can I ask you to raise a support case with the following information?

1. Reproduce the issue and note the time of the test and the Backup Copy that had issues
2. Collect logs from the VBR server as per https://veeam.com/kb1832; use the 3rd radio option and select the VBR server
3. Collect the VeeamDatabase backup using the following article: https://www.veeam.com/kb1471

Add all of that to the case, and also please post the exact commands you ran.
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests