PowerShell script exchange
efd121
Enthusiast
Posts: 67 Liked: 6 times
Joined: Aug 07, 2015 8:45 pm
Full Name: David Engler
Contact:
Post
by efd121 » Jun 29, 2017 9:02 pm
this post
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
veremin
Product Manager
Posts: 20413 Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Jun 30, 2017 8:38 am
this post
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.
efd121
Enthusiast
Posts: 67 Liked: 6 times
Joined: Aug 07, 2015 8:45 pm
Full Name: David Engler
Contact:
Post
by efd121 » Jun 30, 2017 12:31 pm
this post
Thanks I will give it a try next week when I'm back in the office
Dave
veremin
Product Manager
Posts: 20413 Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Jun 30, 2017 12:53 pm
this post
Ok, kindly, keep me updated. Thanks.
efd121
Enthusiast
Posts: 67 Liked: 6 times
Joined: Aug 07, 2015 8:45 pm
Full Name: David Engler
Contact:
Post
by efd121 » Jul 05, 2017 2:56 pm
this post
I was able to update my script based on your input and its working as expected. Thanks for the help.
Dave
veremin
Product Manager
Posts: 20413 Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Jul 05, 2017 2:57 pm
this post
You're welcome. Glad to know that my input was helpful. If other questions arise, let me know.
Users browsing this forum: No registered users and 9 guests