Changing the number of restore points without user input

PowerShell script exchange

Changing the number of restore points without user input

Veeam Logoby RaymondV » Mon Nov 24, 2014 2:56 pm

Hi,

We need to change the number of restore points for multiple disk jobs before the start of a tape job and need to change it back again to the old value after the tape job has finished. We want to use pre-backup and post-backup scripts to start PowerShell to do this for us without any user input. I found this code on the forum but it requires input:

Code: Select all
# Set desired Amount of Restore Points
param ([parameter(Mandatory=$true)][string]$RestorePoints)
#
$Jobs = Get-VBRJob
ForEach ($Job in $Jobs)
{
   $Options = $Job.GetOptions()
   $Options.BackupStorageOptions.RetainCycles = $RestorePoints
   $Job.SetOptions($Options)
}


How can I accomplish this without any user input?

Kind regards,
Raymond
RaymondV
Influencer
 
Posts: 13
Liked: 1 time
Joined: Thu Oct 02, 2014 4:01 pm

Re: Changing the number of restore points without user input

Veeam Logoby v.Eremin » Mon Nov 24, 2014 3:07 pm

Schedule this script as both pre and post job activities. Just make sure to change the retaincycles value in accordance with your needs. This script changes retention settings for all existing backup jobs:

Code: Select all
foreach ($Job in (Get-VBRJob | where {$_.isbackup -eq $true}))
{
$Options = $Job.GetOptions()
$Options.BackupStorageOptions.RetainCycles = "Specify here desired value"
$Job.SetOptions($Options)
}


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


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 6 guests