Creating a backup job through powershell starts job directly

PowerShell script exchange

Creating a backup job through powershell starts job directly

Veeam Logoby jwz88 » Fri Sep 05, 2014 6:38 am

Hi,

I created a simple script to create a backup job. When this gets created it directly starts the backup job.
I don't want this to happen, I want it to follow the schedule I submitted with the Job. Any tips?

Add-VBRViBackupJob -Name "$SERVERNAAM" -BackupRepository "Default Backup Repository" -Entity (Find-VBRViEntity -Server "192.168.20.75" -VMsAndTemplates -Name "$SERVERNAAM")
$Job = Get-VBRJob -Name "$SERVERNAAM"
$JobOptions = Get-VBRJobOptions $Job
$JobOptions.BackupTargetOptions.TransformFullToSyntethic = $false
$JobOptions.BackupStorageOptions.EnableFullBackup = $true
$JobOptions.BackupStorageOptions.RetainCycles = $SNAPSHOTS
Set-VBRJobOptions $Job -Options $JobOptions
$ScheduleOptions = Get-VBRJobScheduleOptions $Job
$ScheduleOptions.OptionsDaily.Enabled = $true
$ScheduleOptions.OptionsDaily.Kind = "Weekdays"
$ScheduleOptions.OptionsDaily.Time = "22:00:00"
Set-VBRJobScheduleOptions -Job ($Job) -Options ($ScheduleOptions)
Enable-VBRJobSchedule -Job ($Job)
jwz88
Influencer
 
Posts: 12
Liked: never
Joined: Fri Sep 05, 2014 6:24 am

Re: Creating a backup job through powershell starts job dire

Veeam Logoby v.Eremin » Fri Sep 05, 2014 9:03 am

Can you tell me what time you can see if go to the job schedule settings right after the job has been created? Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 969 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Creating a backup job through powershell starts job dire

Veeam Logoby jwz88 » Fri Sep 05, 2014 9:40 am

It shows on the main page:
<Scheduled>

after a few seconds this changes to: Next run, current time + 5 minutes.

When opening the job it shows the correct schedule.
jwz88
Influencer
 
Posts: 12
Liked: never
Joined: Fri Sep 05, 2014 6:24 am

Re: Creating a backup job through powershell starts job dire

Veeam Logoby v.Eremin » Fri Sep 05, 2014 10:45 am

Hmm, what happens if you try to use slightly different syntax? Will it make any difference?

Code: Select all
$ScheduleOptions = $Job.GetScheduleOptions()
$ScheduleOptions.OptionsContinuous.Enabled = $false
$ScheduleOptions.OptionsMonthly.Enabled = $false
$ScheduleOptions.OptionsPeriodically.Enabled = $false
$ScheduleOptions.OptionsScheduleAfterJob.IsEnabled = $false
$ScheduleOptions.OptionsDaily.Enabled = $true
$ScheduleOptions.OptionsDaily.Kind = "Weekdays"
$ScheduleOptions.OptionsDaily.Time = "13:00:00"
Set-VBRJobScheduleOptions -Job ($Job) -Options ($ScheduleOptions)


I also assume you're on the latest product version, right?

Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 969 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Creating a backup job through powershell starts job dire

Veeam Logoby jwz88 » Fri Sep 05, 2014 11:27 am

Same occurs. It adds the backup job and the next run is first set on <Scheduled>.
After a few seconds it changes to the current time + 5 minutes as next run time, while the schedule is for 22:00:00

Running on latest version, 7.0.0.871
jwz88
Influencer
 
Posts: 12
Liked: never
Joined: Fri Sep 05, 2014 6:24 am

Re: Creating a backup job through powershell starts job dire

Veeam Logoby v.Eremin » Fri Sep 05, 2014 3:16 pm

We have number of issues related to schedule configuration working improperly in case of PS. So, this must be another instance of those. We're going to review it thoroughly and try to make sure that previous issues won't leak into the next product version. Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 969 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 6 guests