I am trying to figure out how to determine what the next Tape backup job will be using powershell. The script will be run after the tape job is finished to determine what kind of tapes goes offline and what tapes by label has to come online.
The reason for this is tape naming scheme - 001W, 001M, 001Q and 001Y.
Question is - what date format is VBR using to determine first, second, third, fourth and last week of month, quarter and year?
Is it ISO8601?
This is what I got so far, but I read that -UFormat %V (Unix format for ISO) is not reliable
WeeklyOptions : Tuesday 00:00:00
MonthlyOptions : Fourth Tuesday of the month
QuarterlyOptions : Fourth Tuesday of the quarter
YearlyOptions : Fourth Tuesday of the year
Code: Select all
$tapeJob = Get-VBRTapeJob -Name "GFS Tape job"
$tapeJobNextRun = $tapeJob.NextRun
$tapeJobSchedule = $tapeJob.GFSScheduleOptions
$tapeGFSWeekly = $tapeJobSchedule.WeeklyOptions
$tapeGFSMonthly = $tapeJobSchedule.MonthlyOptions
$tapeGFSQuarterly = $tapeJobSchedule.QuarterlyOptions
$tapeGFSYearly = $tapeJobSchedule.YearlyOptions
function parseToNumeric($down) {
$result = switch ($down)
{
"First" {1}
"Second" {2}
"Third" {3}
"Fourth" {4}
"Last" {5}
}
return $result
}
$isYearly = (Get-date $tapeJobNextRun -UFormat %V) -eq (parseToNumeric $tapeGFSYearly.DayOfWeekNumber)