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.
- 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'