Storage-Level Corruption Guard - PS Variable

PowerShell script exchange

Storage-Level Corruption Guard - PS Variable

Veeam Logoby chris.childerhose » Mon Feb 01, 2016 6:21 pm

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, VCAP-DCA, VMCE9, VCP, MCITP
chris.childerhose
Enthusiast
 
Posts: 72
Liked: 6 times
Joined: Wed Aug 13, 2014 6:03 pm
Location: Toronto, ON
Full Name: Chris Childerhose

Re: Storage-Level Corruption Guard - PS Variable

Veeam Logoby v.Eremin » Tue Feb 02, 2016 9:19 am

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.
v.Eremin
Veeam Software
 
Posts: 13558
Liked: 1006 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Storage-Level Corruption Guard - PS Variable

Veeam Logoby chris.childerhose » Tue Feb 02, 2016 2:33 pm

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, VCAP-DCA, VMCE9, VCP, MCITP
chris.childerhose
Enthusiast
 
Posts: 72
Liked: 6 times
Joined: Wed Aug 13, 2014 6:03 pm
Location: Toronto, ON
Full Name: Chris Childerhose

Re: Storage-Level Corruption Guard - PS Variable

Veeam Logoby v.Eremin » Tue Feb 02, 2016 3:57 pm

So, what does $Options.GenerationPolicy.RecheckBackupMonthlyScheduleOptions show in your case? Thanks.
v.Eremin
Veeam Software
 
Posts: 13558
Liked: 1006 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Storage-Level Corruption Guard - PS Variable

Veeam Logoby lightsout » Tue Feb 02, 2016 8:30 pm 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 }
}
lightsout
Expert
 
Posts: 186
Liked: 47 times
Joined: Thu Apr 10, 2014 4:13 pm

Re: Storage-Level Corruption Guard - PS Variable

Veeam Logoby v.Eremin » Fri Feb 05, 2016 2:30 pm

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.
v.Eremin
Veeam Software
 
Posts: 13558
Liked: 1006 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

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

Veeam Logoby egor_ka » Thu May 05, 2016 7:58 am

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.
egor_ka
Lurker
 
Posts: 1
Liked: never
Joined: Thu May 05, 2016 7:44 am
Full Name: Egor Chabala

Re: Storage-Level Corruption Guard - PS Variable

Veeam Logoby v.Eremin » Thu May 05, 2016 10:14 am

Check the answers provided above, and ask for additional help, should it be needed. Thanks.
v.Eremin
Veeam Software
 
Posts: 13558
Liked: 1006 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

[MERGED] Set Backup Job Integrity Check

Veeam Logoby zx81 » Fri Jan 13, 2017 8:35 am

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
zx81
Service Provider
 
Posts: 3
Liked: never
Joined: Thu Nov 24, 2016 6:57 am
Full Name: Don Thomas

Re: Storage-Level Corruption Guard - PS Variable

Veeam Logoby v.Eremin » Fri Jan 13, 2017 11:45 am

Hi, Don,

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

Thanks.
v.Eremin
Veeam Software
 
Posts: 13558
Liked: 1006 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Storage-Level Corruption Guard - PS Variable

Veeam Logoby zx81 » Mon Jan 16, 2017 2:32 am

Thanks, that helps!
zx81
Service Provider
 
Posts: 3
Liked: never
Joined: Thu Nov 24, 2016 6:57 am
Full Name: Don Thomas

Re: Storage-Level Corruption Guard - PS Variable

Veeam Logoby v.Eremin » Mon Jan 16, 2017 10:24 am

You're welcome. Should more assistance with scripting be needed, don't hesitate to let me know. Thanks.
v.Eremin
Veeam Software
 
Posts: 13558
Liked: 1006 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests