If you want to change the amount of restore points and the deleted VMs retention period, you can do this for your backup jobs by hand. But if you need to change a lot of Veeam Backup & Replication Jobs like I needed to do. You can find these settings in the Backup Job properties:

image

If you’re a reader of my blog, you know I like to automate this kind of jobs with Powershell. So I created a function to perform this change for me.

The function:

#requires -pssnapin VeeamPSSnapIn
Function Change-RestorePoints{
<#
.SYNOPSIS
    Change the Backup restore points and deleted VMs retention period
.DESCRIPTION

.NOTES
    Authors: Arne Fokkema
.PARAMETER JobName
    A Backup Job in Veeam Backup & Replication
.PARAMETER RetainDays
    The amount of restore points
.PARAMETER RetainCycles
    The amount of days for Deleted VMs retention period    
.EXAMPLE
    PS> Change-RestorePoints -JobName "Job-01" -RetainDays "21" -RetainCycles "21"
#>
    param(
        [parameter(valuefrompipeline = $true,
            position = 0,
            Mandatory = $true,
            HelpMessage = "Enter a Veeam B&R JobName")]
            $JobName,
        [parameter(valuefrompipeline = $true,
            position = 0,
            Mandatory = $true,
            HelpMessage = "Enter the amount of restore points to keep on disk")]
            $RetainDays,
        [parameter(valuefrompipeline = $true,
            position = 0,
            Mandatory = $true,
            HelpMessage = "Enter a deleted VMs retention period in days")]
            $RetainCycles
    )

    begin{
        $vbrjob = Get-VBRJob  | where {$_.Name -eq $JobName} 
    }
    
    process{
        $options = $vbrjob.GetOptions()
        $options.RetainDays = $RetainDays
        $options.RetainCycles = $RetainCycles
        Write-Host "Changing RetainDays: $($RetainDays) and RetainDays: $($RetainCycles) for job: $($vbrjob.Name)"
        $vbrjob.SetOptions($options)
    }
}

To change a particular job on a Veeam Backup & Replication server you can use the following one-liner:

Change-RestorePoints -JobName "Job-01" -RetainDays "30" -RetainCycles "30"

To change all the jobs on a particular Veeam Backup & Replication Server you can use the following foreach loop:

foreach($job in (Get-VBRJob | Sort Name)){
    Change-RestorePoints -JobName $job.Name -RetainDays "14" -RetainCycles "14"
}

The output will look like this:

image

Advertisement

One thought on “Veeam: Change Restore points and deleted VMs retention period

  1. Thanks for this. One minor note, though. I suspect you intend this line:

    $options.RetainCycles = $RetainDays

    …to be this:

    $options.RetainCycles = $RetainCycles

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.