Setting Tape Monthly Full Backup Schedule Options via PS

PowerShell script exchange

Setting Tape Monthly Full Backup Schedule Options via PS

Veeam Logoby aaron@ARB » Tue Jun 14, 2016 10:58 am

Hi again... this is back to an issue that I reported previously which did not end up getting resolved but rather worked around. Consider the following code snippet (running 9.0U1)

Code: Select all
Add-PSSnapin -Name VeeamPSSnapIn
$Job = Get-VBRTapeJob -name "Tapejob-P1-ARBTest"
$FullMediaPool = $job.FullBackupMediaPool
$MonthlyOptions = New-VBRMonthlyOptions -DayNumberInMonth OnDay -DayOfMonth 31 -Month February
$ScheduleOptions = New-VBRBackupToTapeScheduleOptions -MonthlyOptions $MonthlyOptions
Set-VBRBackupToTapeJob -Job $job -FullBackupMediaPool $FullMediaPool


returns the error

Code: Select all
Set-VBRBackupToTapeJob : OnDay
At C:\Install\Untitled5.ps1:6 char:1
+ Set-VBRBackupToTapeJob -Job $job -FullBackupMediaPool $FullMediaPool
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-VBRBackupToTapeJob], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException,Veeam.Backup.PowerShell.Cmdlets.SetVBRBackupToTapeJob


Looking at the reference guide https://helpcenter.veeam.com/backup/powershell/set-vbrbackuptotapejob.html only refers to the required options being the job and the full backup media pool (which I have specified as you can see).

Even if I then execute something rather innocuous like the below
Code: Select all
Add-PSSnapin -Name VeeamPSSnapIn
$Job = Get-VBRTapeJob -name "Tapejob-P1-ARBTest"
$FullMediaPool = $job.FullBackupMediaPool
$ScheduleOptions = $job.ScheduleOptions
Set-VBRBackupToTapeJob -Job $job -FullBackupMediaPool $FullMediaPool -ScheduleOptions $ScheduleOptions


Which should do pretty much nothing.. fails with the same issue.

What 'OnDay' reference is it referring to?

The only reference that I can find is https://helpcenter.veeam.com/backup/powershell/new-vbrmonthlyoptions.html where as you can see above you execute something like

Code: Select all
$MonthlyOptions = New-VBRMonthlyOptions -DayNumberInMonth OnDay -DayOfMonth 31 -Month February


Just out of curiosity, if I set the monthly full backup schedule to feb 31st each year and then run
Code: Select all
PS C:\install> $Job = Get-VBRTapeJob -name "Tapejob-P1-ARBTest"
PS C:\install> $job.ScheduleOptions.MonthlyOptions
Period           : 22:00:00
DayNumberInMonth : Fourth
DayOfWeek        : Saturday
Months           : {January, February, March, April...}
DayOfMonth       : 1

It returns the default values even though I have set them in the job to be the 31st of February.

If I create the Monthly options code directly via

Code: Select all
PS C:\install> $MonthlyOptions = New-VBRMonthlyOptions -DayNumberInMonth OnDay -DayOfMonth 31 -Month February
PS C:\install> $MonthlyOptions
Period           : 22:00:00
DayNumberInMonth : OnDay
DayOfWeek        : Saturday
Months           : {February}
DayOfMonth       : 31


You can see that it actually returns what It suppose to. Does this point to an issue with the code that gets and sets the monthly schedule options within the cmdlet?

Likewise the issue is present when trying to add a job while specifying MonthlyOptions.

Code: Select all
$MonthlyOptions = New-VBRMonthlyOptions -DayNumberInMonth OnDay -DayOfMonth "31" -Months February
$ScheduleOptions = New-VBRBackupToTapeScheduleOptions -MonthlyOptions $MonthlyOptions
$NotificationOptions = New-VBRNotificationOptions -AdditionalAddress itadmin@arb.com.au -UseNotificationOptions:$false -EnableAdditionalNotification:$true
Add-VBRBackupToTapeJob -name "AAA-TestTapeJob" -EjectCurrentMedium:$false -FullBackupMediaPool "Week2" -IncrementalBackupMediaPool "Week2" -ScheduleOptions $ScheduleOptions -Object $VBRJob -ProcessIncrementalBackup:$true -UseHardwareCompression:$false -WaitForBackupJob:$true -WaitPeriod 10 -NotificationOptions $NotificationOptions


I have tried to use -verbose and -debug but it doesn't display any additional information

Could someone kindly point out what the issue is? What is the correct syntax to set the monthly full backup schedule? There is no way to disable it which is peculiar to start with but i am trying to get 'around' it by setting it to the 31st of Feb which means it wont ever happen
aaron@ARB
Expert
 
Posts: 112
Liked: 12 times
Joined: Fri Feb 21, 2014 3:12 am
Full Name: Aaron @ ARB

Re: Setting Tape Monthly Full Backup Schedule Options via PS

Veeam Logoby aaron@ARB » Fri Jun 17, 2016 5:27 am

case 01827134 has been logged with support regarding this.
aaron@ARB
Expert
 
Posts: 112
Liked: 12 times
Joined: Fri Feb 21, 2014 3:12 am
Full Name: Aaron @ ARB

Re: Setting Tape Monthly Full Backup Schedule Options via PS

Veeam Logoby v.Eremin » Tue Jun 21, 2016 10:41 am

I'm not sure what you're trying to achieve with the provided examples. So, can you shed some light on the underlying goal? Thanks.
v.Eremin
Veeam Software
 
Posts: 13295
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Setting Tape Monthly Full Backup Schedule Options via PS

Veeam Logoby aaron@ARB » Tue Jun 21, 2016 10:57 pm

Pointing out that there may be an issue with the code is the side issue, the main issue was trying to work around disabling the full virtual full backup. I did post this question before and was told that its not possible hence my trying to work around it but then faced the above issue
aaron@ARB
Expert
 
Posts: 112
Liked: 12 times
Joined: Fri Feb 21, 2014 3:12 am
Full Name: Aaron @ ARB

Re: Setting Tape Monthly Full Backup Schedule Options via PS

Veeam Logoby v.Eremin » Wed Jun 22, 2016 9:25 am

Getting back to your script, then. What you get is a known bug fixed in version 9 Update 2. Thanks.
v.Eremin
Veeam Software
 
Posts: 13295
Liked: 973 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 12 guests