PowerShell script exchange
Post Reply
mar41004
Lurker
Posts: 2
Liked: never
Joined: Jun 15, 2021 8:51 am
Full Name: Markeus Woodworth
Contact:

Powershell Copy Job

Post by mar41004 »

Hi,

I am trying to script a VM Copy Job through powershell. I have manged to change some of the settings using the script below:

Code: Select all

Asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Backup Copy Job Name"
$Options = $Job.GetOptions()
$Options.generationPolicy.SimpleRetentionRestorePoints = "5"
$Options.generationPolicy.GFSWeeklyBackups = "0"
$Options.generationPolicy.GFSMonthlyBackups = "6"
$Options.generationPolicy.GFSMonthlyBackupsEnabled = "True"
$Options.generationPolicy.WeeklyBackupDayOfWeek = "Friday"
Set-VBRJobOptions -Job $Job -Options $Options
Is there any way to enable "keep the following restore points as full backups for archival purposes" and also change the Schedule day for Weekly, Monthly and Yearly to be a Friday?

Thanks
oleg.feoktistov
Veeam Software
Posts: 1919
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Powershell Copy Job

Post by oleg.feoktistov »

Hi Markeus and welcome to the R&D forums,

Do you mean settings for agent backup copy jobs or regular ones? Currently, the ways to set these options differ a lot for both.

Thanks,
Oleg
mar41004
Lurker
Posts: 2
Liked: never
Joined: Jun 15, 2021 8:51 am
Full Name: Markeus Woodworth
Contact:

Re: Powershell Copy Job

Post by mar41004 »

Hi Oleg,

Thanks for the reply. The copy jobs are for regular ones. We are doing a Backup Copy of a Virtual Machine to our offsite storage so no agents are being used.

Thanks

Markeus
oleg.feoktistov
Veeam Software
Posts: 1919
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Powershell Copy Job

Post by oleg.feoktistov »

Hi Markeus,

Got it. Then you are after GFSPolicy property. It's all there:

Code: Select all

$job = Get-VBRJob -Name 'Backup Copy Job 1'
$options = $Job.GetOptions()
$GFS = $options.GFSPolicy
$GFS.IsEnabled = $true
$GFS.Weekly.IsEnabled = $true
$GFS.Weekly.DesiredTime = 'Friday'
$GFS.Weekly.KeepBackupsForNumberOfWeeks = 2
Set-VBRJobOptions -Job $job -Options $options 
I'm not sure though what you mean by changing a schedule day to Friday for Monthly and Yearly backups. The day option is available only for Weekly ones.

Thanks,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests