PowerShell script exchange
Post Reply
aaron@ARB
Expert
Posts: 138
Liked: 14 times
Joined: Feb 21, 2014 3:12 am
Full Name: ARBCorporationPtyLtd
Contact:

Setting Tape Monthly Full Backup Schedule Options via PS

Post by aaron@ARB »

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/pow ... pejob.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/pow ... tions.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: 138
Liked: 14 times
Joined: Feb 21, 2014 3:12 am
Full Name: ARBCorporationPtyLtd
Contact:

Re: Setting Tape Monthly Full Backup Schedule Options via PS

Post by aaron@ARB »

case 01827134 has been logged with support regarding this.
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Setting Tape Monthly Full Backup Schedule Options via PS

Post by veremin »

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.
aaron@ARB
Expert
Posts: 138
Liked: 14 times
Joined: Feb 21, 2014 3:12 am
Full Name: ARBCorporationPtyLtd
Contact:

Re: Setting Tape Monthly Full Backup Schedule Options via PS

Post by aaron@ARB »

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
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Setting Tape Monthly Full Backup Schedule Options via PS

Post by veremin »

Getting back to your script, then. What you get is a known bug fixed in version 9 Update 2. Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests