Set tape job to third sunday

PowerShell script exchange

Set tape job to third sunday

Veeam Logoby efd121 » Thu Jun 29, 2017 9:02 pm

I'm having trouble setting a new tape job to run on specific day of the month. In this example I want the job to run on the third Sunday
When the job is created it schedules it for daily at 1:23 and when I change it to monthly at this time the only settings i see changed are OptionsDaily.Enabled changes from True to False and the OptionsMonthly.Enabled changes from False to True
I tried using the code below to make the same changes but the job is still scheduled to run daily.
Can anyone point me in the right direction?
Dave
Code: Select all
$Weekend = "Third"
$DayToRun = "Sunday"
$MonthlyOptions = New-VBRMonthlyOptions -DayNumberInMonth $Weekend -DayOfWeek $DayToRun -Period 1:23
$SchedOptions = New-VBRBackupToTapeScheduleOptions -Type Monthly -MonthlyOptions $MonthlyOptions -Enabled

$Options = Get-VBRJobScheduleOptions -Job $TapeJob
$Options.OptionsDaily.Enabled = $false
$Options.OptionsMonthly.Enabled = $true

Set-VBRJobScheduleOptions -Options $Options -Job $TapeJob
efd121
Enthusiast
 
Posts: 25
Liked: never
Joined: Fri Aug 07, 2015 8:45 pm
Full Name: David Engler

Re: Set tape job to third sunday

Veeam Logoby v.Eremin » Fri Jun 30, 2017 8:38 am

Try the following script and see whether it meets your expectations:

Code: Select all
$TapeJob = Get-VBRTapeJob -Name "Name of your backup to tape job"
$MonthlyOptions = New-VBRMonthlyOptions -DayOfWeek Sunday -DayNumberInMonth Third
$ScheduleOptions = New-VBRBackupToTapeScheduleOptions -Type Monthly -MonthlyOptions $MonthlyOptions -Enabled
Set-VBRBackupToTapeJob -ScheduleOptions $ScheduleOptions -Job $TapeJob


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

Re: Set tape job to third sunday

Veeam Logoby efd121 » Fri Jun 30, 2017 12:31 pm

Thanks I will give it a try next week when I'm back in the office
Dave
efd121
Enthusiast
 
Posts: 25
Liked: never
Joined: Fri Aug 07, 2015 8:45 pm
Full Name: David Engler

Re: Set tape job to third sunday

Veeam Logoby v.Eremin » Fri Jun 30, 2017 12:53 pm

Ok, kindly, keep me updated. Thanks.
v.Eremin
Veeam Software
 
Posts: 13868
Liked: 1038 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Set tape job to third sunday

Veeam Logoby efd121 » Wed Jul 05, 2017 2:56 pm

I was able to update my script based on your input and its working as expected. Thanks for the help.
Dave
efd121
Enthusiast
 
Posts: 25
Liked: never
Joined: Fri Aug 07, 2015 8:45 pm
Full Name: David Engler

Re: Set tape job to third sunday

Veeam Logoby v.Eremin » Wed Jul 05, 2017 2:57 pm

You're welcome. Glad to know that my input was helpful. If other questions arise, let me know.
v.Eremin
Veeam Software
 
Posts: 13868
Liked: 1038 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 1 guest