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 Software
Posts: 209
Liked: 71 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Austin, TX
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 | @AustinVMUG & @ATXPowerShell leader | VMUG US South Regional Champion | 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 Software
Posts: 209
Liked: 71 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Austin, TX
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 | @AustinVMUG & @ATXPowerShell leader | VMUG US South Regional Champion | VMware vExpert | Cisco Champion

bib_ak
Enthusiast
Posts: 30
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: 30
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: 501
Liked: 169 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: 30
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: 501
Liked: 169 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: 30
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: 501
Liked: 169 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: 501
Liked: 169 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

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests