PowerShell script exchange
Post Reply
oli4
Enthusiast
Posts: 63
Liked: 3 times
Joined: Aug 14, 2012 11:34 am
Contact:

Set options for Backup Copy job

Post by oli4 »

Hello all

I try to change some settings of a Backup Copy job, with the Options:

- enable the Backup Copy job
- set Restore points to 30 days
- set VM retention to 40 days

But it doesnt seems to work like with a normal Backup job.

Regards
oli4
PTide
Product Manager
Posts: 6408
Liked: 724 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: Set options for Backup Copy job

Post by PTide »

Hi,
But it doesnt seems to work like with a normal Backup job.
Please describe what result did you expect and how it differs from what you got.

Thank you.
oli4
Enthusiast
Posts: 63
Liked: 3 times
Joined: Aug 14, 2012 11:34 am
Contact:

Re: Set options for Backup Copy job

Post by oli4 »

Hello

I try with this:

Code: Select all

$Job = Get-VBRJob -Name <Name of Backup Copy job>
$Options = $Job.GetOptions()
$Options.BackupStorageOptions.RetainCycles = 40
$Options.BackupStorageOptions.EnableDeletedVmDataRetention = $True
$Options.JobOptions.RunManually = $false 
$Job.SetOptions($Options)
But it didn't change anything. As far as I understood for backup copy jobs you also have to use Get-VBRJob options.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Set options for Backup Copy job

Post by veremin »

I think the following example should to the trick:

Code: Select all

$Job = Get-VBRJob -Name "Backup Copy Job 1"

#Enable a backup copy job 
Enable-VBRJob -Job $Job

#Disable a backup copy job
Disable-VBRJob -Job $Job

$Options = $Job.GetOptions()

#Set simple retention to 30
$Options.GenerationPolicy.SimpleRetentionRestorePoints = "30"

#Enable deleted VM retention
$Options.GenerationPolicy.EnableDeletedVmDataRetention = $True

#Set deleted VM retention to 40
$Options.GenerationPolicy.DeletedVmsDataRetentionPeriodDays = "40"

#Apply new settings
$Job.SetOptions($Options)
Be aware that most of the backup copy job specific settings can be found under .Options.GenerationPolicy subnode.

Thanks.
oli4
Enthusiast
Posts: 63
Liked: 3 times
Joined: Aug 14, 2012 11:34 am
Contact:

Re: Set options for Backup Copy job

Post by oli4 »

Thanks, with this it worked.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Set options for Backup Copy job

Post by veremin »

You're welcome. Let me know, if you come across any issue with scripting. Thanks.
Post Reply

Who is online

Users browsing this forum: ekulaga and 17 guests