PowerShell script exchange
Post Reply
chris.childerhose
Veeam Vanguard
Posts: 572
Liked: 132 times
Joined: Aug 13, 2014 6:03 pm
Full Name: Chris Childerhose
Location: Toronto, ON
Contact:

Storage-Level Corruption Guard - PS Variable

Post by chris.childerhose »

I have checked the new V9 Powershell reference guide but the Advanced Settings > Maintenance variables don't seem to be showing. What are the variables for the Corruption Guard and Backup File Maintenance?

Might help to have a Sticky that shows these new variables until the User Guide is updated.
-----------------------
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Storage-Level Corruption Guard - PS Variable

Post by veremin »

Most of these setting can be found under Options.GenerationPolicy

Code: Select all

$Job = Get-VBRJob -name "Name of your Job"
$Options = $Job.getoptions()
$Options.GenerationPolicy
More specifically,

Code: Select all

EnableCompactFull                       
CompactFullBackupScheduleKind           
CompactFullBackupDays                   
CompactFullBackupMonthlyScheduleOptions 
EnableRechek                            
RecheckScheduleKind                     
RecheckDays                             
RecheckBackupMonthlyScheduleOptions
Thanks.
chris.childerhose
Veeam Vanguard
Posts: 572
Liked: 132 times
Joined: Aug 13, 2014 6:03 pm
Full Name: Chris Childerhose
Location: Toronto, ON
Contact:

Re: Storage-Level Corruption Guard - PS Variable

Post by chris.childerhose »

Thanks. I set a job to run the Health Check and then used the script to check the settings but don't see this option set in the ones you listed. I changed the default setting to Second Monday of the month but showing the settings of this job does not show this setting variable.
-----------------------
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Storage-Level Corruption Guard - PS Variable

Post by veremin »

So, what does $Options.GenerationPolicy.RecheckBackupMonthlyScheduleOptions show in your case? Thanks.
lightsout
Expert
Posts: 227
Liked: 62 times
Joined: Apr 10, 2014 4:13 pm
Contact:

Re: Storage-Level Corruption Guard - PS Variable

Post by lightsout » 1 person likes this post

Ah perfect, so this thread gave me the start I needed.

I wanted to enable storage guard on all of my backup jobs, and distribute it over the entire month, so I wrote the below. This enables enable storage-guard for every backup job and set it to run over a monthly period.

Code: Select all

# Create all backup copy jobs and set them up as necessary.
if ((Get-PSSnapin -Name VeeamPSSnapin -ErrorAction SilentlyContinue) -eq $null) {add-pssnapin VeeamPSSnapin}

$days=@("Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday")
$weeks=@("First", "Second", "Third", "Fourth", "Last")

$d=0
$w=0

$jobs=get-vbrjob | ? {$_.JobType -eq "Backup"} | sort Name
foreach ($job in $jobs) {
  write-host $job.Name $days[$d] $weeks[$w]

  $Options=$job.getoptions()
  $Options.GenerationPolicy.RecheckScheduleKind = "Monthly"
  $Options.GenerationPolicy.RecheckBackupMonthlyScheduleOptions.DayOfWeek = $days[$d]
  $Options.GenerationPolicy.RecheckBackupMonthlyScheduleOptions.DayNumberInMonth = $weeks[$w]
  $Options.GenerationPolicy.EnableRechek = $true
  $job.SetOptions($Options) | out-null
  
  $d++
  if ($d -ge $days.count) { $d = 0 ; $w++ }
  if ($w -ge $weeks.count) { $w = 0 }
}
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Storage-Level Corruption Guard - PS Variable

Post by veremin »

Thanks for sharing the resulting code. Just be aware that sometimes the fourth week will coincide with the last, so, you will get two jobs running corruption guard at the same day. Thanks.
egor_ka
Lurker
Posts: 1
Liked: never
Joined: May 05, 2016 7:44 am
Full Name: Egor Chabala
Contact:

[MERGED] : Enable "Perform backup files health check" using

Post by egor_ka »

Hi Guys,

Please, help me to find a solution to enable "Perform backup files health check" option using PowerShell.
I want to run it on Monthly basis.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Storage-Level Corruption Guard - PS Variable

Post by veremin »

Check the answers provided above, and ask for additional help, should it be needed. Thanks.
zx81
Service Provider
Posts: 13
Liked: 1 time
Joined: Nov 24, 2016 6:57 am
Location: Perth, Australia
Contact:

[MERGED] Set Backup Job Integrity Check

Post by zx81 »

Hi,

I'm trying to set the Veeam Bckup Job Storage-level corruption guard health checkbox and schedule, as found in Storage---> Advanced Settings-----> Maintenance tab. For example, I might want the backup health checks to be performed for a particular job Monthly on the Last Friday. For the life of me I can't find the powershell options to do it. I thought it would be something like:

Code: Select all

Set-VBRJobAdvancedOptions -Job $jobname -EnableIntegrityChecks $True
But I can't see how to set the schedule, and if I run the command above it runs without error but doesn't tick the health checkbox and use the existing default schedule. Any pointers as to what I'm doing wrong would be appreciated.

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

Re: Storage-Level Corruption Guard - PS Variable

Post by veremin »

Hi, Don,

Kindly, check my answer provided above. Hopefully, it will help you to clarify your confusion.

Thanks.
zx81
Service Provider
Posts: 13
Liked: 1 time
Joined: Nov 24, 2016 6:57 am
Location: Perth, Australia
Contact:

Re: Storage-Level Corruption Guard - PS Variable

Post by zx81 »

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

Re: Storage-Level Corruption Guard - PS Variable

Post by veremin »

You're welcome. Should more assistance with scripting be needed, don't hesitate to let me know. Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests