PowerShell script exchange
Post Reply
RaymondV
Influencer
Posts: 16
Liked: 1 time
Joined: Oct 02, 2014 4:01 pm
Contact:

Changing the number of restore points without user input

Post by RaymondV »

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
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Changing the number of restore points without user input

Post by veremin »

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.
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests