I wish to change the retention period on all my copy jobs. I have the PoweShell code working on a single job:
- Code: Select all
$Job = Get-VBRJob -name "Copy Job One"
$Options = $Job.GetOptions()
$Options.GenerationPolicy.RetentionPolicyType = "GFS"
$Options.GenerationPolicy.GFSWeeklyBackups = 4
$Options.GenerationPolicy.GFSMonthlyBackups = 0
$Options.GenerationPolicy.GFSQuarterlyBackups = 0
$Options.GenerationPolicy.GFSYearlyBackups = 0
I now wish to run these commands against a list copy job names I have in a text file called CopyJobs.txt. I am a bit of a PowerShell newbie and having trouble getting this working, any help to apply the above commands to a list of jobs in a text file would be greatly appreciated.