PowerShell script exchange
Post Reply
mb78
Novice
Posts: 5
Liked: never
Joined: Nov 11, 2020 11:07 pm
Full Name: matt b
Contact:

Script to amend Backup Jobs Retention Points

Post by mb78 »

Hi

Has anyone got a PS script that can be used to set Backup Jobs Retention Period? I've got over 200 Backup Jobs, so ideally want to script this :)

I'm struggling and can only find scripts and reference to BackupCopyJobs not Backup Jobs

I want to check all jobs are set to 'X' retention points and also to change them to 'Days' not 'Restore Points' now we've changed to Veeam 13.

thanks
M
david.domask
Product Manager
Posts: 3728
Liked: 909 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Script to amend Backup Jobs Retention Points

Post by david.domask »

Hi mb78,

Code: Select all

$jobs = Get-VBRJob | Where-Object {$_.TypeToString -like "Vmware*"} #for VMware, you can remove the pipe to Where-Object to get all supported jobs
$jOpts = Get-VBRJobOptions -Job $jobs
$jOpts.BackupStorageOptions.RetainDaysToKeep
This will reflect the simple retention restore points, GFS is stored under the GenerationPolicy property of $jOpts.

But basically everything you need to check / set is under BackupStorageOptions returned by Get-VBRJobOptions.

Code: Select all

PS /root> $jOpts = Get-VBRJobOptions -Job $jobs[0]
PS /root> $jOpts.BackupStorageOptions

CheckRetention               : True
RetentionType                : Days
RetainCycles                 : 7
RetainDaysToKeep             : 7
KeepFirstFullBackup          : False
RetainDays                   : 14
EnableDeletedVmDataRetention : False
CompressionLevel             : 5
EnableDeduplication          : True
StgBlockSize                 : KbBlockSize1024
EnableIntegrityChecks        : True
EnableFullBackup             : False
BackupIsAttached             : False
UseSpecificStorageEncryption : False
StorageEncryptionEnabled     : False
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 66 guests