PowerShell script exchange
matteu
Veeam Legend
Posts: 818 Liked: 127 times
Joined: May 11, 2018 8:42 am
Contact:
Post
by matteu » Jan 24, 2023 6:29 pm
this post
Hello,
I'm trying to set this value in powershell but it doesn't work as expected.
I tried to help me with this :
powershell-f26/remove-deleted-items-dat ... 55489.html
When I use powershell command to see the value, they are updated but on the GUI it's always "disable" and with 14 days value. Is there a new method to perform this task on V11 ?
I also tried this method :
Code: Select all
$Options = New-VBRJobOptions -ForBackupJob
$Options.BackupStorageOptions.RetainCycles = 28
$Options.GenerationPolicy.EnableDeletedVmDataRetention = $True
$Options.GenerationPolicy.DeletedVmsDataRetentionPeriodDays = 19
$BkpJob = Get-VBRJob -Name "bkp_dc"
Set-VBRJobOptions -Job $BkpJob -Options $Options | Out-Null
david.domask
Veeam Software
Posts: 2113 Liked: 509 times
Joined: Jun 28, 2016 12:12 pm
Contact:
Post
by david.domask » Jan 25, 2023 10:39 am
this post
Hi
@matteu ,
Yes, it's under BackupStorageOptions as well for the Deleted Machine Retention (DMR).
See this example for one of my VMware backup jobs:
Code: Select all
PS F:\perjobbackups\vss-test> $options.BackupStorageOptions
CheckRetention : True
RetentionType : Cycles
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
PS F:\perjobbackups\vss-test> $options.BackupStorageOptions.EnableDeletedVMDataRetention = $true
PS F:\perjobbackups\vss-test> $options.BackupStorageOptions.RetainDays = 19
PS F:\perjobbackups\vss-test> Set-VBRJobOptions -Job $job -Options $options
Job Name Type State Last Result Description
-------- ---- ----- ----------- -----------
vss-test VMware Backup Stopped Success Created by DDOM-VEEAM-RB4\Admin
Retention Type controls Days vs Points, RetainDays controls the DMR retention.
David Domask | Product Management: Principal Analyst
matteu
Veeam Legend
Posts: 818 Liked: 127 times
Joined: May 11, 2018 8:42 am
Contact:
Post
by matteu » Jan 25, 2023 12:11 pm
1 person likes this post
Thanks for the answer
It's working fine with the new location
Code: Select all
$Options = New-VBRJobOptions -ForBackupJob
$Options.BackupStorageOptions.RetainCycles = 28
$Options.BackupStorageOptions.EnableDeletedVmDataRetention = $True
$Options.BackupStorageOptions.RetainDays= 19
$BkpJob = Get-VBRJob -Name "bkp_dc"
Set-VBRJobOptions -Job $BkpJob -Options $Options | Out-Null
david.domask
Veeam Software
Posts: 2113 Liked: 509 times
Joined: Jun 28, 2016 12:12 pm
Contact:
Post
by david.domask » Jan 25, 2023 12:32 pm
this post
Happy to help! Glad it worked out
David Domask | Product Management: Principal Analyst
matteu
Veeam Legend
Posts: 818 Liked: 127 times
Joined: May 11, 2018 8:42 am
Contact:
Post
by matteu » Jan 27, 2023 8:54 am
this post
I need to configure the same option but for backup copy job
It doesn't work if I use the same code but specify my backup copy job name.
I see New-VBRJobOptions has only ForBackupJob or ForReplicaJob parameter.
How can I achieve this goal ?
matteu
Veeam Legend
Posts: 818 Liked: 127 times
Joined: May 11, 2018 8:42 am
Contact:
Post
by matteu » Jan 27, 2023 9:00 am
this post
OK, I find the answer here :
powershell-f26/powershell-to-set-storag ... 83000.html
This is working :
Code: Select all
$Options = New-VBRJobOptions -ForBackupJob
$BkpCopyJob = Get-VBRJob -Name "bkpcopy_dc"
$Options.Generationpolicy.Enabledeletedvmdataretention = $True
$Options.GenerationPolicy.DeletedVMsDataRetentionPeriodDays = 10
Set-VBRJobOptions -Job $BkpCopyJob -Options $Options | Out-Null
AndyU
Lurker
Posts: 2 Liked: never
Joined: Apr 25, 2023 10:46 am
Full Name: AU
Contact:
Post
by AndyU » Apr 25, 2023 10:54 am
this post
Sorry to resurrect an old thread, but how do you set this parameter for the new Veeam v12 jobs.
I have upgraded Backup Copy jobs from v11 -> v12 that I need to programmatically set this value for and the scripts above don't seem to work for v12.
I can still see the value under "GenerationPolicy.DeletedVMsDataRetentionPeriodDays" but I can't set it using "Set-VBRJobOptions" as that command isn't supported anymore for v12 backup copy jobs.
david.domask
Veeam Software
Posts: 2113 Liked: 509 times
Joined: Jun 28, 2016 12:12 pm
Contact:
Post
by david.domask » Apr 25, 2023 1:23 pm
1 person likes this post
Hi
@AndyU ,
Check my answer and workaround here:
post483391.html#p483391
David Domask | Product Management: Principal Analyst
AndyU
Lurker
Posts: 2 Liked: never
Joined: Apr 25, 2023 10:46 am
Full Name: AU
Contact:
Post
by AndyU » Apr 25, 2023 2:01 pm
this post
thanks for the swift response and solution. I don't know why I didn't find that when searching for my issue.
I can confirm this works a treat.
Many thanks
david.domask
Veeam Software
Posts: 2113 Liked: 509 times
Joined: Jun 28, 2016 12:12 pm
Contact:
Post
by david.domask » Apr 25, 2023 2:15 pm
this post
Glad I could help
@AndyU Hopefully we will see this in future releases Soon™
David Domask | Product Management: Principal Analyst
Users browsing this forum: No registered users and 8 guests