PowerShell script exchange
Post Reply
Amerloc
Influencer
Posts: 12
Liked: 1 time
Joined: Mar 08, 2012 9:26 am
Full Name: Adolfo Alvarez
Contact:

"Next run" time when creating a job

Post by Amerloc »

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.
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: "Next run" time when creating a job

Post by ThomasMc »

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*
Amerloc
Influencer
Posts: 12
Liked: 1 time
Joined: Mar 08, 2012 9:26 am
Full Name: Adolfo Alvarez
Contact:

Re: "Next run" time when creating a job

Post by Amerloc »

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.
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: "Next run" time when creating a job

Post by ThomasMc »

No, LatestRun is the one I want you to manipulate as Next run is calculated off of this
Amerloc
Influencer
Posts: 12
Liked: 1 time
Joined: Mar 08, 2012 9:26 am
Full Name: Adolfo Alvarez
Contact:

Re: "Next run" time when creating a job

Post by Amerloc »

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.
Andreas Neufert
VP, Product Management
Posts: 6747
Liked: 1408 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: "Next run" time when creating a job

Post by Andreas Neufert »

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

CU Andy
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: "Next run" time when creating a job

Post by ThomasMc »

I finally got round to testing this in v6, some odd changes in there :)
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests