PowerShell script exchange
Post Reply
matteu
Veeam Legend
Posts: 818
Liked: 127 times
Joined: May 11, 2018 8:42 am
Contact:

Remove deleted items data after

Post by matteu »

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:

Re: Remove deleted items data after

Post by david.domask »

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:

Re: Remove deleted items data after

Post by matteu » 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:

Re: Remove deleted items data after

Post by david.domask »

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:

Re: Remove deleted items data after

Post by matteu »

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:

Re: Remove deleted items data after

Post by matteu »

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:

Re: Remove deleted items data after

Post by AndyU »

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:

Re: Remove deleted items data after

Post by david.domask » 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:

Re: Remove deleted items data after

Post by AndyU »

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:

Re: Remove deleted items data after

Post by david.domask »

Glad I could help @AndyU :) Hopefully we will see this in future releases Soon™
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests