PowerShell script exchange
Post Reply
Piotr
Influencer
Posts: 19
Liked: never
Joined: Oct 09, 2013 2:18 pm
Full Name: Piotr Brzozowski
Contact:

"Remove deleted items data after" value in Powershell

Post by Piotr »

Hi,

Does anybody know how to change in Powershell "Remove deleted items data after" value (Storage -> Advanced -> Maintenance -> Full backup file maintenance) in VBR job?

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

Re: "Remove deleted items data after" value in Powershell

Post by veremin »

Try this script:

Code: Select all

Asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of your job"
$Options = $Job.GetOptions()
$Options.backupstorageoptions.retaindays = "Value that you want to set"
Set-VBRJobOptions -Job $Job -Options $Options
Thanks!
Piotr
Influencer
Posts: 19
Liked: never
Joined: Oct 09, 2013 2:18 pm
Full Name: Piotr Brzozowski
Contact:

Re: "Remove deleted items data after" value in Powershell

Post by Piotr »

Hi,

It works!

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

Re: "Remove deleted items data after" value in Powershell

Post by veremin »

You're welcome.

Basically, all job settings are distributed among different option set in $Job.GetOptions(). For instance, backup job advanced storage settings can be found in $Options.BackupStorageOptions, backup job advanced notifications settings - in $Options.NotificationOptions, etc.

So, whenever you struggle with finding the necessary property in PS, just change it in GUI and locate where it gets reflected in option set and, then, write a script, using the approach above.

Thanks!
kb1ibt
Influencer
Posts: 14
Liked: never
Joined: Apr 24, 2015 1:40 pm
Contact:

Re: "Remove deleted items data after" value in Powershell

Post by kb1ibt »

I want to thank you for this thread, I just ran into a bug (Case # 03365723) in 9.5u4 with Backup Copy jobs and needed to follow these instructions to get it working again.

Code: Select all

$job = Get-VBRJob -Name "Name of your job"
$options = $job.GetOptions()
$options.generationpolicy.DeletedVmsDataRetentionPeriodDays = "30"
Set-VBRJobOptions -Job $job -Options $options
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: "Remove deleted items data after" value in Powershell

Post by veremin »

Not sure whether I follow you on that. Are saying that this script stopped working, after you had upgraded to Update 4? Thanks.
kb1ibt
Influencer
Posts: 14
Liked: never
Joined: Apr 24, 2015 1:40 pm
Contact:

Re: "Remove deleted items data after" value in Powershell

Post by kb1ibt »

The console stopped working in U4 if the value for that field is (the default) 180, even if the check mark is unchecked. So I needed to use the Powershell in order to adjust the number of days in order to access the Advanced settings.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: "Remove deleted items data after" value in Powershell

Post by veremin »

Ah, I didn't get at first that it wasn't the script that didn't work :)

Good to know that the script helped you to fix the issue.

Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests