PowerShell script exchange
Post Reply
Piotr
Influencer
Posts: 15
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 » Nov 26, 2018 2:56 pm

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: 16666
Liked: 1390 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 » Nov 26, 2018 3:02 pm

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: 15
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 » Dec 04, 2018 11:45 am

Hi,

It works!

Thanks

veremin
Product Manager
Posts: 16666
Liked: 1390 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 » Dec 04, 2018 12:19 pm

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 » Jan 24, 2019 3:42 am

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: 16666
Liked: 1390 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 » Jan 24, 2019 10:24 am

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 » Jan 24, 2019 2:12 pm

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: 16666
Liked: 1390 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 » Jan 24, 2019 3:02 pm

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 1 guest