PowerShell script exchange
Post Reply
tom_nl
Enthusiast
Posts: 43
Liked: 7 times
Joined: Nov 02, 2018 9:13 am
Contact:

Enabling active full in job

Post by tom_nl »

Hi,

I want to enable active fulls on a job with PowerShell, but I'm not able to make it work.
I use the example from here: https://helpcenter.veeam.com/docs/backu ... ml?ver=110

$activefull = New-VBRFullBackupOptions -Enable -ScheduleType Weekly -SelectedDays Sunday, Wednesday
Set-VBRFullBackupOptions -Options $activefull -Enable -ScheduleType Monthly -DayNumber OnDay -DayOfWeek Friday

But how do you save this to a specified job?
ronnmartin61
Veeam Software
Posts: 540
Liked: 193 times
Joined: Mar 07, 2016 3:55 pm
Full Name: Ronn Martin
Contact:

Re: Enabling active full in job

Post by ronnmartin61 »

Something like this should do the trick if -

Code: Select all

$backupjob = Get-VBRJob -Name 'My Backup Job'
$backupjoboptions = Get-VBRJobOptions -Job $backupjob
$backupjoboptions.BackupStorageOptions.EnableFullBackup = $true
Set-VBRJobOptions -Job $backupjob -Options $backupjoboptions
tom_nl
Enthusiast
Posts: 43
Liked: 7 times
Joined: Nov 02, 2018 9:13 am
Contact:

Re: Enabling active full in job

Post by tom_nl »

That works. But how do I set the schedule options for the active full? That should be done with the cmdlet in my first post, right?
ronnmartin61
Veeam Software
Posts: 540
Liked: 193 times
Joined: Mar 07, 2016 3:55 pm
Full Name: Ronn Martin
Contact:

Re: Enabling active full in job

Post by ronnmartin61 »

Sorry thought you were just asking about enabling fulls. If you're just looking to enable active fulls on Sunday and Thursday's -

Code: Select all

$bj = Get-VBRComputerBackupJob -Name 'My Agent Job'

$activefull = New-VBRFullBackupOptions -Enable -ScheduleType Weekly -SelectedDays Sunday, Thursday

Set-VBRComputerBackupJob -Job $bj -ActiveFullOptions $activefull
tom_nl
Enthusiast
Posts: 43
Liked: 7 times
Joined: Nov 02, 2018 9:13 am
Contact:

Re: Enabling active full in job

Post by tom_nl »

Not exactly what I'm looking for. I'm using agent job, but a VMware, so I would use "Set-VBRJobOptions" I think.
But that cmdlet doesn't accept the "-ActiveFullOptions" parameter.
ronnmartin61
Veeam Software
Posts: 540
Liked: 193 times
Joined: Mar 07, 2016 3:55 pm
Full Name: Ronn Martin
Contact:

Re: Enabling active full in job

Post by ronnmartin61 »

Since you referenced "Set-VBRComputerBackupJob" which is only applicable for agent jobs I assumed you were dealing with an agent job type. You need to use Set-VBRJobAdvancedBackupOptions example follows -

Code: Select all

$j = Get-VBRJob -Name 'My Job'

Set-VBRJobAdvancedBackupOptions -Job $j -EnableFullBackup $true -FullBackupDays @('Friday'; 'Monday')
tom_nl
Enthusiast
Posts: 43
Liked: 7 times
Joined: Nov 02, 2018 9:13 am
Contact:

Re: Enabling active full in job

Post by tom_nl »

Thanks! That did the trick.

I use this now to enable GFS on a job:

Code: Select all

        $Options = $job.GetOptions()
        $Options.backupstorageoptions.retaincycles = 31
        $Options.GenerationPolicy.EnableCompactFull = $False
  
        $Options.GfsPolicy.IsEnabled = $true
        $Options.GfsPolicy.Weekly.IsEnabled = $false
        $Options.GfsPolicy.Monthly.IsEnabled = $true
        $Options.GfsPolicy.Monthly.KeepBackupsForNumberOfMonths = 3
        $Options.GfsPolicy.Yearly.IsEnabled = $false
        Set-VBRJobOptions -Job $job -Options $Options

        Set-VBRJobAdvancedBackupOptions -Job $job -EnableFullBackup $true -FullBackupScheduleKind Monthly -Months @('January'; 'February'; 'March'; 'April'; 'May'; 'June'; 'July'; 'August'; 'September'; 'October'; 'November'; 'December';)
ronnmartin61
Veeam Software
Posts: 540
Liked: 193 times
Joined: Mar 07, 2016 3:55 pm
Full Name: Ronn Martin
Contact:

Re: Enabling active full in job

Post by ronnmartin61 »

Very good!
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests