PowerShell script exchange
Post Reply
SmithJohn
Enthusiast
Posts: 47
Liked: never
Joined: Jan 31, 2013 3:36 am
Full Name: charles
Contact:

how to change number of restore points

Post by SmithJohn »

how to change number of restore points to be kept for a new job or an existing job through powershell ?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: how to change number of restore points

Post by veremin »

Hi, Charles, it can be done via Get/SetOptions method.

For instance, the following example will set 18 as a number of restore points the backup job keeps:

Code: Select all

$Job = Get-VBRJob -name "Name of backup job"
$Options = $Job.GetOptions()
$Options.BackupStorageOptions.RetainCycles = 18
$Job.SetOptions($Options)
Thanks.
LarsWulf
Enthusiast
Posts: 38
Liked: 7 times
Joined: Nov 28, 2011 9:05 pm
Full Name: Lars Wulf
Contact:

Re: how to change number of restore points

Post by LarsWulf » 1 person likes this post

Hi everybody,

I was facing a similar problem. I needed to change the amount of restore points for all my 42 jobs. So I found the code from Vladimir and extended it with a Prompt for the amount of Restore Points and a loop for all jobs. Maybe this helps somebody else who needs to change the restore points for all his jobs.

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)
}
Regards
Lars
emmoon1981
Novice
Posts: 5
Liked: never
Joined: Jul 09, 2016 9:34 am
Full Name: Ehsan Mohseni
Contact:

[MERGED] Set Retention Policy

Post by emmoon1981 »

I was wondering if there is a powershell CMDlet to set the number of "Restore point to keep on disk" for specific job/all jobs.
Thanks
Vitaliy S.
VP, Product Management
Posts: 27055
Liked: 2710 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Set Retention Policy

Post by Vitaliy S. »

Try to use the script example provided above.
mjplakus
Lurker
Posts: 1
Liked: never
Joined: Mar 13, 2020 7:49 pm
Full Name: Michael Plakus
Contact:

Re: how to change number of restore points

Post by mjplakus »

For the current Powershell addin the script needs to be modified slightly.

Code: Select all

# Set desired Amount of Restore Points
param ([parameter(Mandatory=$true)][string]$RestorePoints)
#
$Jobs = Get-VBRJob
ForEach ($Job in $Jobs)
{
	$Options = Get-VBRJobOptions $Job
    $Options.BackupStorageOptions.RetainCycles = $RestorePoints
    Set-VBRJobOptions $Job $Options
}
Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests