Cannot enable VM retention policy

PowerShell script exchange

Cannot enable VM retention policy

Veeam Logoby vmm » Fri Nov 27, 2015 10:05 am

Code: Select all
$vps = Find-VBRViEntity -Name "vps-8"
$repository = Get-VBRBackupRepository -Name "Backup Repository 1"
Add-VBRViBackupJob -Name "DM_TEST" -Entity $vps -BackupRepository $repository
Get-VBRJob -Name "DM_TEST" | Set-VBRJobAdvancedBackupOptions -Algorithm ReverseIncremental
Get-VBRJob -Name "DM_TEST" | Set-VBRJobAdvancedOptions -RetainDays 14
Get-VBRJob -Name "DM_TEST" | Set-VBRJobAdvancedViOptions -VMToolsQuiesce $True
$Job = Get-VBRJob -Name "DM_TEST"
$Options = $Job.GetOptions()
$Options.SanIntegrationOptions.FailoverFromSan = $True
$Options.BackupStorageOptions.StgBlockSize = "KbBlockSize512"
$Options.BackupStorageOptions.RetainCycles = 1
$Job.SetOptions($Options)


After issuing this script I can change VM retention policy (number of days) but can not enable it
vmm
Service Provider
 
Posts: 15
Liked: never
Joined: Mon Nov 23, 2015 10:09 am
Full Name: Marat Akhmetianov

Re: Cannot enable VM retention policy

Veeam Logoby v.Eremin » Fri Nov 27, 2015 10:41 am

What do you mean by enable? The retention policy is enabled by default, and cannot be disabled. Or you're talking about deleted VM retention?
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Cannot enable VM retention policy

Veeam Logoby vmm » Fri Nov 27, 2015 10:51 am

Yes for deleted VM retention.
vmm
Service Provider
 
Posts: 15
Liked: never
Joined: Mon Nov 23, 2015 10:09 am
Full Name: Marat Akhmetianov

Re: Cannot enable VM retention policy

Veeam Logoby v.Eremin » Fri Nov 27, 2015 11:05 am

Then, try the following script:

Code: Select all
$Job = Get-VBRJob -Name "Job Name"
$Options = $Job.GetOptions()
$Job.BackupStorageOptions.EnableDeletedVmDataRetention = $true
$Options.BackupStorageOptions.RetainDays = "Desired value"
$Job.SetOptions($Options)


Thanks.
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Cannot enable VM retention policy

Veeam Logoby vmm » Fri Nov 27, 2015 11:16 am

Great. Thanks. Everything worked
vmm
Service Provider
 
Posts: 15
Liked: never
Joined: Mon Nov 23, 2015 10:09 am
Full Name: Marat Akhmetianov

Re: Cannot enable VM retention policy

Veeam Logoby v.Eremin » Fri Nov 27, 2015 11:28 am

You're welcome. Should other help be needed, don't hesitate to let us know. Thanks.
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 8 guests