Backup Copy Job Advanced Options (Add-VBRViBackupCopyJob)

PowerShell script exchange

Backup Copy Job Advanced Options (Add-VBRViBackupCopyJob)

Veeam Logoby jb303uk » Mon Jun 08, 2015 10:36 am

Hi,
I was wondering if anyone could help, I'm trying to create a Backup Copy job using powershell but the documentation only references basic settings (for Add-VBRViBackupCopyJob http://helpcenter.veeam.com/backup/80/powershell/index.html?add-vbrvibackupcopyjob.html).
Is there a way to alter settings such as:
    Number of backups to keep for Archival purposes eg: Keep 12 Monthly backups & 7 Yearly backups
    When the Full backups happen (eg Last Friday of the Week/Month/Quarter/Year)
    Number of Restore points to keep

Hope someone can help!

Thanks
James
jb303uk
Novice
 
Posts: 7
Liked: never
Joined: Wed Feb 11, 2015 11:27 am

Re: Backup Copy Job Advanced Options (Add-VBRViBackupCopyJob

Veeam Logoby v.Eremin » Mon Jun 08, 2015 11:03 am

Most of settings of backup copy job can be configured in the following way:

Code: Select all
$BCJ = Get-VBRJob -name "Name of your backup copy job"
$Options = $BCJ.GetOptions()
$Options.GenerationPolicy
#Change those however you like
$BCJ.SetOptions($Options)


GenerationPolicy contains the following settings.

Image

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

Re: Backup Copy Job Advanced Options (Add-VBRViBackupCopyJob

Veeam Logoby jb303uk » Mon Jun 08, 2015 2:21 pm

Hi,
Thankyou for your help, I have managed to change these settings via Powershell thankyou, however (rather embarrassingly) I can't get the tick box 'Keep the following restore points for archival purposes' to be ticked :oops:
Image
Can you solve my last piece of the puzzle?
jb303uk
Novice
 
Posts: 7
Liked: never
Joined: Wed Feb 11, 2015 11:27 am

Re: Backup Copy Job Advanced Options (Add-VBRViBackupCopyJob

Veeam Logoby v.Eremin » Mon Jun 08, 2015 10:02 pm 1 person likes this post

You should play with RetentionPolicyType parameter, change its value from "simple" to something like "GFS" (need to check that, as currently I don't have access to a console). Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Backup Copy Job Advanced Options (Add-VBRViBackupCopyJob

Veeam Logoby jb303uk » Tue Jun 09, 2015 12:31 pm

v.Eremin wrote:You should play with RetentionPolicyType parameter, change its value from "simple" to something like "GFS" (need to check that, as currently I don't have access to a console). Thanks.


Bingo thats it no need to check!
Here's the code I used

Code: Select all
$ArcJobObj = Get-VBRJob -name "My Job X"; 
$Options = $ArcJobObj.GetOptions();
$options.GenerationPolicy.RetentionPolicyType = "GFS";
$ArcJobObj.SetOptions($Options);
$Options.GenerationPolicy;


Thankyou for your help

James
jb303uk
Novice
 
Posts: 7
Liked: never
Joined: Wed Feb 11, 2015 11:27 am

Re: Backup Copy Job Advanced Options (Add-VBRViBackupCopyJob

Veeam Logoby v.Eremin » Tue Jun 09, 2015 5:41 pm

Glad to hear that you've nailed it. By the way, the last string doesn't serve any practical use apart from showing the updated backup copy job settings, so, you might want to remove it completely. Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

[MERGED] Change options for a Backup Copy job

Veeam Logoby twesterd » Wed May 31, 2017 6:09 pm

I am still new to PowerShell with Veeam and my first impression is that the documentation doesn't include the objects/properties related to each command. This makes for a lot of hunting around. In Visual Studio, I add the Veeam dll references and can cast the objects to the correct types and that helps substantially. In PowerShell, I can display an object as output in the console, or otherwise use the get-members command and hunt around that way.

I thought it might be helpful to provide a sample of changing the commonly configured properties for a Backup Copy job. In my use-case, all copy jobs are GFS (grandfather, father, son). So, this example related to GFS jobs and their settings. You should be able to insert the correct Backup Copy job's name and the snippet should work. Change values and you can then associate which property matches which item in the GUI. I clone a job in the GUI, leave it disabled, and play around with settings to match properties to screen values. Hopefully, it helps someone. Took me a while to put all of these together as I didn't even know to look in the GenerationPolicy selection.

Sample below:
Code: Select all
$Job = Get-VBRJob -Name 'Template Backup Copy Jobs'
$Options = $Job.GetOptions()
$Options.GenerationPolicy.RetentionPolicyType = 'GFS'
$Options.GenerationPolicy.GFSWeeklyBackups = 1
$Options.GenerationPolicy.GFSMonthlyBackups = 2
$Options.GenerationPolicy.GFSQuarterlyBackups = 3
$Options.GenerationPolicy.GFSYearlyBackups = 4
$Options.GenerationPolicy.EnableRechek = $True
$Options.GenerationPolicy.RecheckDays = [System.DayOfWeek] 'Friday', 'Monday'
$Options.GenerationPolicy.RecheckScheduleKind = 'Monthly'
$Options.GenerationPolicy.SyncIntervalStartTime = '14:30:00'
$Options.GenerationPolicy.SimpleRetentionRestorePoints = 14
$Options.GenerationPolicy.WeeklyBackupDayOfWeek = 'Thursday'
$Options.GenerationPolicy.WeeklyBackupTime = '19:15:00'
$Options.GenerationPolicy.RecoveryPointObjectiveUnit = 'Day'
$Options.GenerationPolicy.RecoveryPointObjectiveValue = 1
$Options.GenerationPolicy.RecheckBackupMonthlyScheduleOptions.DayNumberInMonth = 'Third'
$Options.GenerationPolicy.RecheckBackupMonthlyScheduleOptions.DayOfWeek = 'Wednesday'
$Options.GenerationPolicy.RecheckBackupMonthlyScheduleOptions.Months = [Veeam.Backup.Common.Emonth] 'January', 'February'
$Job.SetOptions($Options)
twesterd
Influencer
 
Posts: 17
Liked: never
Joined: Wed May 17, 2017 7:38 pm
Full Name: Trevor W


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 3 guests