PowerShell script exchange
Post Reply
csimpson
Service Provider
Posts: 2
Liked: never
Joined: Dec 05, 2019 10:12 am
Full Name: Colm Simpson
Contact:

Job NextRun is empty

Post by csimpson »

HI there,

I am trying to get the NextRun for a job, I can see it in the GUI but powershell seems to return blank:
Image

I was wondering if there was a way to get the next run time using powershell without having to calculate it from the schedule?

Many thanks

Colm
jhoughes
Veeam Vanguard
Posts: 279
Liked: 112 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: Job NextRun is empty

Post by jhoughes »

Check the 'StartDateTimeLocal' property.

This sample will give you the next run time, for all jobs with a schedule enabled:

Code: Select all

Get-VBRJob -WarningAction SilentlyContinue | Where-Object {$_.IsScheduleEnabled} | Select-Object Name, @{n='NextRunTime';e={$_.ScheduleOptions.StartDateTimeLocal}}
Note, there may be inconsistencies if you are using period options (every 4 hours), as it will display the first run of the day without the periodic cycle.
Husband, Father, Solutions Architect, Geek Extraordinaire | @DenverVMUG, @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion
csimpson
Service Provider
Posts: 2
Liked: never
Joined: Dec 05, 2019 10:12 am
Full Name: Colm Simpson
Contact:

Re: Job NextRun is empty

Post by csimpson »

Hey Joe,

Thanks for the quick reply, It seems as though its getting the first time the Job was ran:
Image

The top three follow the scheduled one and then each other so I'm not too worried about them but the last one seems to be referring to the first time the job was ran. This is set to run Daily-Everyday if that makes a difference?

Many thanks

Colm
jhoughes
Veeam Vanguard
Posts: 279
Liked: 112 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: Job NextRun is empty

Post by jhoughes »

When you say follow, do you mean they are chained? If so, they would not have their own start time which gives your results.

As for the start time of the 4th job, I'm not sure why it is showing the original start time, as it should get updated for the next run time.

Here's a quick dump from one of my labs (the only job with periodic runs is titled 'AUSVCENTER-NoTag'):

Code: Select all

Get-VBRJob -WarningAction SilentlyContinue | Where-Object {$_.IsScheduleEnabled} | Select-Object Name, @{n='NextRunTime';e={$_.ScheduleOptions.StartDateTimeLocal}} | Sort-Object NextRunTime

Name               NextRunTime
----               -----------
AUSVCENTER-NoTag   5/12/2020 04:05:00
DomainControllers  5/12/2020 12:25:00
AUSVCENTER-TagTest 5/12/2020 13:05:00
vCenterServers     5/12/2020 19:00:00
SOBRBackupTest     5/12/2020 22:00:00
Husband, Father, Solutions Architect, Geek Extraordinaire | @DenverVMUG, @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion
bib_ak
Enthusiast
Posts: 33
Liked: 1 time
Joined: Jan 31, 2010 12:57 pm
Contact:

Re: Job NextRun is empty

Post by bib_ak »

I have used ScheduleOptions.NextRun successfully for years, but after upgrading to Veeam 10 most of the jobs have this field empty... ScheduleOptions.StartDateTimeLocal does NOT give next scheduled run, just as OP describes...

This is a critical bug (lets hope it's a bug, an not a "feature" do deprecate this field without notice), and effectively prevent me from upgrading to Veeam 10.
bib_ak
Enthusiast
Posts: 33
Liked: 1 time
Joined: Jan 31, 2010 12:57 pm
Contact:

Re: Job NextRun is empty

Post by bib_ak »

Besides - IsScheduleEnabled is always true in Veeam 10. What's going on?
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Job NextRun is empty

Post by oleg.feoktistov »

Yes, we are aware of NextRun bug. Should be fixed in one of the next product releases.
As for IsScheduleEnabled - there is the other property that renders this info correctly:

Code: Select all

$job = Get-VBRJob -Name 'BackupJob'
$job.Options.JobOptions.RunManually
Thanks!
bib_ak
Enthusiast
Posts: 33
Liked: 1 time
Joined: Jan 31, 2010 12:57 pm
Contact:

Re: Job NextRun is empty

Post by bib_ak »

Thank you for the workaround oleg.feoktistov. But I have to say - this should not be happening. I see no reason whatsoever justifying abandoning IsScheduleEnabled without notice. I would expect such things for software developed and maintained by a single person worth $19.90 - not an enterprise product...

Sorry for the rant, it just feels like a worthless use of time rewriting scripts for 50+ customers because of this.
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Job NextRun is empty

Post by oleg.feoktistov »

Hi @bib_ak,

From which version you upgraded to v10?
Sorry for the rant, it just feels like a worthless use of time rewriting scripts for 50+ customers because of this.
Did you have IsScheduleEnabled updating normally in the version you upgraded your VBR from?

I just tested it on v9.5 u4b (that's as old lab as I could get right away) and the problem is the same there.

Thanks!
Oleg
bib_ak
Enthusiast
Posts: 33
Liked: 1 time
Joined: Jan 31, 2010 12:57 pm
Contact:

Re: Job NextRun is empty

Post by bib_ak »

Not sure - v9.5 <something>. Yes, IsScheduleEnabled was working just fine before the upgrade. But I have multiple installations of v9.5.4.2753 (I believe this is called 9.5 update 4a) where IsScheduleEnabled is working as expected.
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Job NextRun is empty

Post by oleg.feoktistov »

Hi @bib_ak,

I raised this question internally with QA and we agreed on investigating it as soon as v10a release rush settles down.
We will keep you posted.

Thanks,
Oleg
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Job NextRun is empty

Post by oleg.feoktistov » 1 person likes this post

Hi @bib_ak,

Apologies for being off the radar for a while.
Discussed and tested with QA in both v 9.5 u4a and v10. Here is our conclusion, which is valid for both versions:
  • IsScheduleEnabled - renders disabled/enabled state of a job. Works correctly on the corresponding actions.
  • JobOptions.RunManually - shows if schedule is enabled. Also works correctly when ticking/unticking the corresponding checkbox in the UI.
I believe we had no reason to change this logic between 9.5 u4a -10 versions.
Nonetheless, it would be great if you could double check if you see the same behaviour across your VBR versions.
If something looks off, please, submit a case and let our support engineers handle that.

Thank you,
Oleg
bib_ak
Enthusiast
Posts: 33
Liked: 1 time
Joined: Jan 31, 2010 12:57 pm
Contact:

Re: Job NextRun is empty

Post by bib_ak »

What about the NextRun bug? Still not fixed?
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Job NextRun is empty

Post by oleg.feoktistov » 1 person likes this post

@bib_ak, fixed in v10a with the below:

Code: Select all

$job = Get-VBRJob -Name 'BackupJob'
$jobSchedule = Get-VBRJobScheduleOptions -Job $job
$jobSchedule.NextRun
Thanks!
bib_ak
Enthusiast
Posts: 33
Liked: 1 time
Joined: Jan 31, 2010 12:57 pm
Contact:

Re: Job NextRun is empty

Post by bib_ak »

"10a" - do I need to upgrade from 10.0.0.4461, not working in this release... Can you please confirm this was fixed in 10.0.1.4854?
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Job NextRun is empty

Post by oleg.feoktistov »

Correct, fixed in 10.0.1.4854 (v10a) with the solution above. Thanks!
meelisn
Influencer
Posts: 17
Liked: never
Joined: Jun 09, 2020 2:21 pm
Full Name: Meelis Nigols
Contact:

Re: Job NextRun is empty

Post by meelisn »

What about older versions? 9.5 for example?
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Job NextRun is empty

Post by oleg.feoktistov »

Now I cannot tell for sure as I don't have a lab with 9.5 at my disposal, but as far as I remember, in 9.5 it was available with (Get-VBRJob).ScheduleOptions.NextRun
Thanks!
bib_ak
Enthusiast
Posts: 33
Liked: 1 time
Joined: Jan 31, 2010 12:57 pm
Contact:

Re: Job NextRun is empty

Post by bib_ak »

meelisn wrote: Oct 08, 2020 7:12 am What about older versions? 9.5 for example?
I can confirm this is not an issue in v9 prior 9.5 update 4a

Testet and working in 10.0.1.4854 just as Oleg says - thanks. Now, let's hope it will be working for some time :)
PalalHotline
Lurker
Posts: 2
Liked: 1 time
Joined: Nov 04, 2020 1:13 pm
Contact:

Job NextRun is empty

Post by PalalHotline »

Hi,
I have an issue since I upgraded Veeam from 9 to 10.

I have a PowerShell script that generate me a report for the last week backups. In this report, I have for each backup jobs a NextRun date and time.
But since I upgraded to version 10, the script tell me the job is not scheduled. After analysis, the property NextRun is empty, but in the Veeam console I am able to see the next run date and time.

Image

I use the Get-VBRJob to get information about job. And after $job.ScheduleOptions.NextRun to get the date.

Is somebody already had this issue? How do you fixed it?
Thank you
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Job NextRun is empty

Post by oleg.feoktistov » 1 person likes this post

Hi @PalalHotline,

Merged your post with the existing thread.
Please, check the answers above.

Thanks,
Oleg
PalalHotline
Lurker
Posts: 2
Liked: 1 time
Joined: Nov 04, 2020 1:13 pm
Contact:

Re: Job NextRun is empty

Post by PalalHotline » 1 person likes this post

Hi @oleg.feokistov,
Thank you.

I fixed my issue with upgrade to 10a and follow your code.

Thanks again.
Regards
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest