PowerShell script exchange
Post Reply
dbr
Enthusiast
Posts: 64
Liked: 3 times
Joined: Apr 06, 2017 9:48 am
Full Name: Daniel Brase
Contact:

Change interval time of backup copy job via powershell

Post by dbr » May 10, 2017 6:46 am

Hi all,

I would like to script creation of our backup and backup copy jobs cause of job redesign. I'm struggeling with changing the default interval time from 00:00 to 18:00 in a backup copy job. It's easy for a backup job: Set-VBRJobSchedule -Job <backupjobname> -daily -at 18:00. But I couldn't find a suiteable cmdlet or any other way to set the interval time of a copy job. Set-VBRJobSchedule doesn't seem to work with backup copy jobs.

Error:

Code: Select all

Set-VBRJobSchedule : Specify a backup job
At line:1 char:1
+ Set-VBRJobSchedule -Job se-bc-62 -daily -at 18:00
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-VBRJobSchedule], Exception
    + FullyQualifiedErrorId : System.Exception,Veeam.Backup.PowerShell.Cmdlets.SetVBRJobSchedule
Does anyone know how to change interval time through powershell?

Daniel

dbr
Enthusiast
Posts: 64
Liked: 3 times
Joined: Apr 06, 2017 9:48 am
Full Name: Daniel Brase
Contact:

Re: Change interval time of backup copy job via powershell

Post by dbr » May 10, 2017 12:49 pm

I figured out the solution by myself:

Code: Select all

$timespan = new-timespan -hours 18
$joboptions = get-vbrjoboptions -job se-bc-62
$joboptions.GenerationPolicy.SyncIntervalStartTime = $timespan
set-vbrjoboptions -job se-bc-62 -options $joboptions
Thanks.

shanewendel
Lurker
Posts: 1
Liked: never
Joined: Jan 29, 2019 5:45 pm
Full Name: Shane Wendel
Contact:

Re: Change interval time of backup copy job via powershell

Post by shanewendel » Jan 29, 2019 5:50 pm

This code doesn't quite work because that isn't the proper settings variable

This is the correct code to change the interval:

Code: Select all

#Ensure the Copy Interval is set to 1 hour
$joboptions = get-vbrjoboptions -job "Backup Copy Job"
$joboptions.GenerationPolicy.RecoveryPointObjectiveUnit = "Hour"
$joboptions.GenerationPolicy.RecoveryPointObjectiveValue = 1
set-vbrjoboptions -job "Backup Copy Job" -options $joboptions

dbr
Enthusiast
Posts: 64
Liked: 3 times
Joined: Apr 06, 2017 9:48 am
Full Name: Daniel Brase
Contact:

Re: Change interval time of backup copy job via powershell

Post by dbr » Jan 30, 2019 9:06 am

I guess your code works well if you want to change the interval type e.g. from daily to hourly. My original demand was only to set the interval start time to a different time (00:00 to 18:00) while keeping interval type. So my code works as well for interval type daily.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests