PowerShell script exchange
Post Reply
Cyril_Mars
Novice
Posts: 3
Liked: never
Joined: Aug 06, 2015 11:36 am
Full Name: Cyril
Contact:

Change sync hour backup copy

Post by Cyril_Mars »

Hi,

I create a post job script in backup job in order to launch his backup copy sync :

Code: Select all

Add-PSSnapin VeeamPSSnapin

$Job = Get-VBRJob –name "BACKUP COPY TEST"
Sync-VBRBackupCopyJob –Job $Job

This backup copy job have an interval copy of 1 day with an hour.
I need add to this script the possibility to change the hour copy interval for his next synchronization.

In fact the script must replace the hour interval job by the actual hour of system. In this case, the backup copy job will have 1 day for copying backup job and will sync the day after at the same hour.

Do you have an idea for scripting this?

Thank you
PTide
Product Manager
Posts: 6427
Liked: 728 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: Change sync hour backup copy

Post by PTide »

Hi,

There is an option to set some parameters manually.

Assume you've created a copy job named, say, "Backup Copy Job 1". The method provided below is not recommended.

Code: Select all

$bcJob = get-vbrjob -Name "Backup Copy Job 1"
$bcjob.Options.GenerationPolicy

EnableDeletedVmDataRetention            : False
DeletedVmsDataRetentionPeriodDays       : 30
RecoveryPointObjectiveValue             : 13
RecoveryPointObjectiveUnit              : Minute
SyncIntervalStartTime                   : 00:00:00
RetentionPolicyType                     : Simple
KeepGfsBackup                           : False
SimpleRetentionRestorePoints            : 7
EnableCompactFull                       : False
CompactFullBackupScheduleKind           : Monthly
CompactFullBackupDays                   : {Saturday}
CompactFullBackupMonthlyScheduleOptions : Veeam.Backup.Model.CDomFullBackupMonthlyScheduleOp
EnableRechek                            : True
RecheckScheduleKind                     : Monthly
RecheckDays                             : {Saturday}
RecheckBackupMonthlyScheduleOptions     : Veeam.Backup.Model.CDomFullBackupMonthlyScheduleOp
GFSRecentPoints                         : 7
GFSWeeklyBackups                        : 4
GFSMonthlyBackups                       : 0
GFSQuarterlyBackups                     : 0
GFSYearlyBackups                        : 0
WeeklyBackupDayOfWeek                   : Sunday
WeeklyBackupTime                        : 22:00:00
MonthlyBackup                           : Veeam.Backup.Model.CDomMonthlyBackupCreationTime
QuarterlyBackup                         : Veeam.Backup.Model.CDomQuarterlyBackupCreationTime
YearlyBackup                            : Veeam.Backup.Model.CDomYearlyBackupCreationTime
Now you need to set some values. Example:

Code: Select all

$bcJob.Options.GenerationPolicy.RecoveryPointObjectiveValue = 13
$bcJob.Options.GenerationPolicy.RecoveryPointObjectiveUnit = 0
Units: 0 for minutes, 1 for hours, 2 for days.

P.S. Nevertheless, I'd recommend you to find some workaround using task scheduler.

Thank you.
Cyril_Mars
Novice
Posts: 3
Liked: never
Joined: Aug 06, 2015 11:36 am
Full Name: Cyril
Contact:

Re: Change sync hour backup copy

Post by Cyril_Mars »

Hi,

Thank you for your response. It works :)
However, why these commands are not recommanded?

When yo talk about task scheduler, it concerns scheduleOptions commands?
Thank you
PTide
Product Manager
Posts: 6427
Liked: 728 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: Change sync hour backup copy

Post by PTide »

Hi,
why these commands are not recommanded?
Because it happens so, that people tweaking anything what is not in a reference guide may accidentally do something wrong (no offense, it happens to all of us :) ). Another reason - nobody can guarantee that in next release/build something won't change in such way that the mentioned workaround becomes unusable. With that said - be very careful using any undocumented tricks.
When yo talk about task scheduler, it concerns scheduleOptions commands?
It concerns Windows built-in Task Scheduler.

Thank you.
PTide
Product Manager
Posts: 6427
Liked: 728 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: Change sync hour backup copy

Post by PTide »

Could you please clarify what exactly are you trying to accomplish? It seems to me that there should be a simpler way of scheduling backup copy job.

Thank you.
Cyril_Mars
Novice
Posts: 3
Liked: never
Joined: Aug 06, 2015 11:36 am
Full Name: Cyril
Contact:

Re: Change sync hour backup copy

Post by Cyril_Mars »

Hello,

Sorry for the delay.
The problem is solved.

Thank you
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests