"Next run" time when creating a job

PowerShell script exchange

"Next run" time when creating a job

Veeam Logoby Amerloc » Thu Mar 08, 2012 2:27 pm

When I create a backup job in Powershell and set the schedule options, the job's "Next run" time is not the time I've specified in Powershell but it is 2 minutes after the time job was created. But If I go to Schedule options in job's properties, the time I see there is the one I specified in Powershell and if I modify any parameter here and press Finish, then the "Next run" field gets updated with the correct time.
Amerloc
Influencer
 
Posts: 12
Liked: 1 time
Joined: Thu Mar 08, 2012 9:26 am
Full Name: Adolfo Alvarez

Re: "Next run" time when creating a job

Veeam Logoby ThomasMc » Wed Mar 14, 2012 7:57 pm

You can change it with something like so

Code: Select all
$job = Get-VBRJob | ?{$_.Name -eq "Test Job 04"}
$schedule = $job.GetScheduleOptions()
$schedule.LatestRun = Get-Date "14/03/2012 19:00:00"
Set-VBRJobScheduleOptions -Job $job -Options $schedule


It will take a short time before you see the change reflected in the GUI

*For v5*
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: "Next run" time when creating a job

Veeam Logoby Amerloc » Thu Mar 22, 2012 11:36 am

Hi Thomas. Thank you for your reply.
You told me to use the "LatestRun" option, I guess you meant "NextRun", but anyway, I have tried both and what it happes when I set the "NextRun" option is that the correct time appears in the GUI but a few seconds afterwards it resets itself to the time of job creation plus 4 minutes (date is correct according to the schedule options). ┬┐Any idea?
Thanks in advance.
Amerloc
Influencer
 
Posts: 12
Liked: 1 time
Joined: Thu Mar 08, 2012 9:26 am
Full Name: Adolfo Alvarez

Re: "Next run" time when creating a job

Veeam Logoby ThomasMc » Thu Mar 22, 2012 11:48 am

No, LatestRun is the one I want you to manipulate as Next run is calculated off of this
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: "Next run" time when creating a job

Veeam Logoby Amerloc » Thu Mar 29, 2012 1:27 pm

Hi Thomas.
I have also tried setting the "LatestRun" option ($schedule.LatestRun = Get-Date "dd/mm/yyyy hh:mm:ss") and I waited for more than 15 minutes but the "NextRun" field is still the time of job creation plus 4 minutes. This is a big problem when I bulk create jobs, because many of them could start running at the same time
Thanks.
Amerloc
Influencer
 
Posts: 12
Liked: 1 time
Joined: Thu Mar 08, 2012 9:26 am
Full Name: Adolfo Alvarez

Re: "Next run" time when creating a job

Veeam Logoby Andreas Neufert » Thu Apr 12, 2012 8:11 pm

Hi all. I think this one works (third post)
Andys scripting corner - List / Set Scheduling Options

CU Andy
Andreas Neufert
Veeam Software
 
Posts: 2198
Liked: 357 times
Joined: Wed May 04, 2011 8:36 am
Location: Germany
Full Name: @AndyandtheVMs Veeam PM

Re: "Next run" time when creating a job

Veeam Logoby ThomasMc » Fri Apr 13, 2012 5:29 pm

I finally got round to testing this in v6, some odd changes in there :)
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell


Return to PowerShell



Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 5 guests