PowerShell script exchange
Post Reply
Ian007
Lurker
Posts: 2
Liked: never
Joined: Jul 01, 2021 2:24 pm
Full Name: Ian James
Contact:

New-VBRDailyOptions

Post by Ian007 »

I have a script that runs at the ened of the month and switches some backups over for tapes. This is done to create month end tapes we send off to be archived.

Anyway, part of the script

Code: Select all

New-VBRDailyOptions -Type SelectedDays -DayOfWeek 'Sunday' -Period 01:00 -AlwaysCopyFromLatestFull
we use to switch the backup to use "Process latest full backup chain only" so that only the last full plus any incremental up to that point were transferred to tape.

Recently we had an issue with SOBR tiering and upgraded to Version 11 to correct the fault.

Now when the powershell script runs, the script section returns an error.

Code: Select all

New-VBRDailyOptions : A parameter cannot be found that matches parameter name 'AlwaysCopyFromLatestFull'
Am I understanding correctly and this switch is no loner available in New-VBRDailyOptions? is this available to script in another way?

Full Script is below to give full context.

Code: Select all

Add-PSSnapin VeeamPSSnapin
$DateTime = ([DateTime]::Today).AddDays(0)
$Weekends = @("Saturday", "Sunday")
$BH = @( $Hols = (Invoke-RestMethod -Uri https://www.gov.uk/bank-holidays.json -Method GET).'england-and-wales'.events.date
Foreach ($Das in $hols){
Get-Date -Date $Das
}
)
$LastDay = (0..31 | ForEach-Object { (Get-Date "$($DateTime.Year)-$($DateTime.Month)-01").AddDays($_) } | Where-Object { $_.Month -eq $($DateTime.Month) } | Where-Object { $_.dayofweek -notin $Weekends } | Where-Object { $_ -notIn $BH })[-1]

$DateTimePlus = ($DateTime).AddDays(1)
$DateTimeSun = ($DateTime).AddDays(2)
$MonthlyJob = ($DateTimePlus.DayOfWeek).ToString()
$MonthlySun = ($DateTimeSun.DayOfWeek).ToString()
$FridayJob = $LastDay.DayOfWeek


If($LastDay -eq $DateTime)
{
    IF ($FridayJob -eq 'Friday')
    {
     #Write-Host Friday so run on $MonthlySun
      Disable-VBRJob -Job "Daily Tape Job LTO6"
      Disable-VBRJob -Job "Daily Tape Job LTO7"
      Enable-VBRJob -Job "Monthly Tape Job LTO6"
      Enable-VBRJob -Job "Monthly Tape Job LTO7"
      Set-VBRBackupToTapeJob -Job "Monthly Tape Job LTO6" -ScheduleOptions (New-VBRBackupToTapeScheduleOptions -Enabled -DailyOptions (New-VBRDailyOptions -Type SelectedDays -DayOfWeek $MonthlySun -Period 01:00 -AlwaysCopyFromLatestFull))
      Set-VBRBackupToTapeJob -Job "Monthly Tape Job LTO7" -ScheduleOptions (New-VBRBackupToTapeScheduleOptions -Enabled -DailyOptions (New-VBRDailyOptions -Type SelectedDays -DayOfWeek $MonthlySun -Period 01:00 -AlwaysCopyFromLatestFull))
    }
    Else
    {
     #Write-Host Monhly Job run on $MonthlyJob
      Disable-VBRJob -Job "Daily Tape Job LTO6"
      Disable-VBRJob -Job "Daily Tape Job LTO7"
      Enable-VBRJob -Job "Monthly Tape Job LTO6"
      Enable-VBRJob -Job "Monthly Tape Job LTO7"
      Set-VBRBackupToTapeJob -Job "Monthly Tape Job LTO6" -ScheduleOptions (New-VBRBackupToTapeScheduleOptions -Enabled -DailyOptions (New-VBRDailyOptions -Type SelectedDays -DayOfWeek $MonthlyJob -Period 01:00 -AlwaysCopyFromLatestFull))
      Set-VBRBackupToTapeJob -Job "Monthly Tape Job LTO7" -ScheduleOptions (New-VBRBackupToTapeScheduleOptions -Enabled -DailyOptions (New-VBRDailyOptions -Type SelectedDays -DayOfWeek $MonthlyJob -Period 01:00 -AlwaysCopyFromLatestFull))

    }
}
Else
{
    If($DateTime -in $BH){
     #Write-Host Bank Holiday
      Disable-VBRJob -Job "Daily Tape Job LTO6"
      Disable-VBRJob -Job "Daily Tape Job LTO7"
      Disable-VBRJob -Job "Monthly Tape Job LTO6"
      Disable-VBRJob -Job "Monthly Tape Job LTO7"
    }

    Else
    {
     #Write-Host Normal Day
      Enable-VBRJob -Job "Daily Tape Job LTO6"
      Enable-VBRJob -Job "Daily Tape Job LTO7"
      Disable-VBRJob -Job "Monthly Tape Job LTO6"
      Disable-VBRJob -Job "Monthly Tape Job LTO7"
    }

}
Ian007
Lurker
Posts: 2
Liked: never
Joined: Jul 01, 2021 2:24 pm
Full Name: Ian James
Contact:

Re: New-VBRDailyOptions

Post by Ian007 »

Apologies.

After taking a break and making some tea, I found the issue. Sorry for wasting you time.

Code: Select all

Set-VBRBackupToTapeJob -Job "Monthly Tape Job LTO6" -AlwaysCopyFromLatestFull -ScheduleOptions (New-VBRBackupToTapeScheduleOptions -Enabled -DailyOptions (New-VBRDailyOptions -Type SelectedDays -DayOfWeek $MonthlySun -Period 01:00))
Moved the switch to VBRBackupToTapeJob and it is working again. Now am not sure why it worked before.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: New-VBRDailyOptions

Post by oleg.feoktistov »

Hi Ian,

This is really weird because -AlwaysCopyFromLatestFull parameter was never a part New-VBRDailyOptions cmdlet. It doesn't even make sense, this option is not related to a job schedule configuration by any means. My first assumption was that in previous versions we didn't have a parameter validation for New-VBRDailyOptions cmdlet in place, but I tested it in v9.5b and got the same error message when trying to execute New-VBRDailyOptions -AlwaysCopyFromLatestFull.

Best regards,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests