Hi,
I want to do the same edit of the retention policy as I read in topic powershell-f26/change-retention-policy- ... 50494.html but only for jobs which name starts with specific text.
thanks
-
- Lurker
- Posts: 2
- Liked: never
- Joined: Mar 24, 2022 7:16 am
- Full Name: Davide V.
- Contact:
-
- Veeam Software
- Posts: 2123
- Liked: 513 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Edit retention policy for all backup jobs which name starts with specific text
Hi Davide, welcome to the forums.
Vladimir's post here should still work: post279504.html#p279504
I will change it slightly thought as there is no need for some of the old methods that were used there.
Replace "SomeText" with your specific text, and replace N with the desired retention value. This is for Restore Points however, if you use Days, let us know as there are different properties to change under BackupStorageOptions.
For example, I have several jobs that start with vmware-, and if I wanted to update their retention, I'd do:
Vladimir's post here should still work: post279504.html#p279504
I will change it slightly thought as there is no need for some of the old methods that were used there.
Code: Select all
$Jobs = Get-VBRJob | where {$_.Jobtype -eq "Backup" -and $_.Name -like "SomeText*"}
foreach ($Job in $Jobs){
$Options = Get-VBRJobOptions -Job $Job
$Options.BackupStorageOptions.RetainCycles = "N"
Set-VBRJobOptions -Job $Job -Options $Options
}
For example, I have several jobs that start with vmware-, and if I wanted to update their retention, I'd do:
Code: Select all
$Jobs = Get-VBRJob | where {$_.Jobtype -eq "Backup" -and $_.Name -like "vmware-*"}
foreach ($Job in $Jobs){
$Options = Get-VBRJobOptions -Job $Job
$Options.BackupStorageOptions.RetainCycles = "64"
Set-VBRJobOptions -Job $Job -Options $Options
}
David Domask | Product Management: Principal Analyst
-
- Lurker
- Posts: 2
- Liked: never
- Joined: Mar 24, 2022 7:16 am
- Full Name: Davide V.
- Contact:
Re: Edit retention policy for all backup jobs which name starts with specific text
Hi David, first of all many thanks for the quick reply, and yes, I would like to use number of Days rather than restore points in the retention policy.
-
- Veeam Software
- Posts: 2123
- Liked: 513 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Edit retention policy for all backup jobs which name starts with specific text
Hi Davide, you're very welcome
For Days, we simply need to change RetainCycles to RetainDaysToKeep
For Days, we simply need to change RetainCycles to RetainDaysToKeep
Code: Select all
$Jobs = Get-VBRJob | where {$_.Jobtype -eq "Backup" -and $_.Name -like "SomeText-*"}
foreach ($Job in $Jobs){
$Options = Get-VBRJobOptions -Job $Job
$Options.BackupStorageOptions.RetainDaysToKeep= "N"
Set-VBRJobOptions -Job $Job -Options $Options
}
David Domask | Product Management: Principal Analyst
Who is online
Users browsing this forum: No registered users and 1 guest