Code: Display Job scheduling options:
Code: Select all
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
$JobName = "Rep001-002-auto-Win2008-XX"
$JobnameObject = Get-VBRJob | Where {$_.Name -eq $JobName}
$JobnameObjectSchedule = $JobnameObject | Get-VBRjobscheduleoptions
$JobnameObjectSchedule
write-host "--------------------------------------------------------------------------------------------"
write-host "OptionsDaily"
$JobnameObjectSchedule.OptionsDaily
write-host "--------------------------------------------------------------------------------------------"
write-host "OptionsMonthly"
$JobnameObjectSchedule.OptionsMonthly
write-host "--------------------------------------------------------------------------------------------"
write-host "OptionsPeriodically"
$JobnameObjectSchedule.OptionsPeriodically
write-host "--------------------------------------------------------------------------------------------"
write-host "OptionsContinuous"
$JobnameObjectSchedule.OptionsContinuous
write-host "--------------------------------------------------------------------------------------------"
write-host "OptionsBackupWindow"
$JobnameObjectSchedule.OptionsBackupWindow
Write-host "Be carefull, OptionsDaily displays optionsdaily.kind as DayNumberInMonth"
Example output:
Code: Select all
PS E:\scripts> E:\scripts\settings\scheduleOptions.ps1
StartDateTime : 11.04.2012 20:00:00
EndDateTimeSpecified : False
EndDateTime : 13.04.2012 21:00:06
RepeatSpecified : False
RepeatNumber : 1
RepeatTimeUnit : hour(s)
RepeatTimeUnitMs : 3600000
RetryTimes : 2
RetryTimeout : 22
RetrySpecified : True
WaitForBackupCompletion : True
BackupCompetitionWaitingPeriodMin : 180
OptionsDaily : Enabled: True, DayNumberInMonth: SelectedDays, Days: Monday, Tuesday, Wednesday, Thursday, Friday
OptionsMonthly : Enabled: False, Time: 11.04.2012 00:00:00, Day Number In Month: Second, Day Of Week: Monday, Months: January, February, March, April, May, June, July, August, September, October,
November, December
OptionsPeriodically : Enabled: False, Period: 1 hour(s), ScheduleString: <scheduler><Sunday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Sunday><Monday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0</Monday><Tuesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Tuesday><Wednesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Wednesday><Thursday>0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0</Thursday><Friday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Friday><Saturday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Saturday></scheduler
>
OptionsContinuous : Enabled: False
OptionsBackupWindow : Veeam.Backup.Model.CBackupWindowOptions
NextRun : 04/12/2012 20:00:00
LatestRun : 11.04.2012 20:16:00
--------------------------------------------------------------------------------------------
OptionsDaily
Enabled : True
Kind : SelectedDays
Days : {Monday, Tuesday, Wednesday, Thursday...}
Time : 11.04.2012 21:00:00
--------------------------------------------------------------------------------------------
OptionsMonthly
Enabled : False
Time : 11.04.2012 00:00:00
DayNumberInMonth : Second
DayOfWeek : Monday
Months : {January, February, March, April...}
--------------------------------------------------------------------------------------------
OptionsPeriodically
Enabled : False
Kind : Hours
FullPeriod : 60
Schedule : <scheduler><Sunday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Sunday><Monday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Monday><Tuesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Tuesd
ay><Wednesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Wednesday><Thursday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Thursday><Friday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Frid
ay><Saturday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Saturday></scheduler>
--------------------------------------------------------------------------------------------
OptionsContinuous
Enabled : False
--------------------------------------------------------------------------------------------
OptionsBackupWindow
IsEnabled : False
BackupWindow : <scheduler><Sunday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Sunday><Monday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Monday><Tuesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Tue
sday><Wednesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Wednesday><Thursday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Thursday><Friday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</
Friday><Saturday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Saturday></scheduler>
Be carefull, OptionsDaily displays optionsdaily.kind as DayNumberInMonth
Code: Select all
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
$JobName = "Rep001-002-auto-Win2008-XX"
$EnableJobAdd = "True" #True/False
$RetrySpecifiedAdd = "True" #True/False
$RetryTimesAdd = "2"
$RetryTimeoutAdd = "22"
$schedulemode = "Daily" #Daily/Monthly/Periodically/Continuous
$OptionsDailyAddKind = "SelectedDays" #Everyday/SelectedDays/WeekDays
$OptionsDailyAddDays = "Monday" , "Tuesday" , "Wednesday" , "Thursday" , "Friday"
$OptionsDailyAddTime = "21:00:00" #Attention: If you set a new time. The "Next run" column in the jobview will be updated after the next job run.
$JobnameObject = Get-VBRJob | Where {$_.Name -eq $JobName}
$JobnameObjectSchedule = $JobnameObject | Get-VBRjobscheduleoptions
If ($RetrySpecifiedAdd -eq "True"){
$JobnameObjectSchedule.RetrySpecified = $true
} ELSE {
$JobnameObjectSchedule.RetrySpecified = $false
}
$JobnameObjectSchedule.RetryTimes = $RetryTimesAdd
$JobnameObjectSchedule.RetryTimeout = $RetryTimeoutAdd
If ($schedulemode -eq "Daily"){
$JobnameObjectSchedule.OptionsDaily.Enabled = $true
$JobnameObjectSchedule.OptionsMonthly.Enabled = $false
$JobnameObjectSchedule.OptionsPeriodically.Enabled = $false
$JobnameObjectSchedule.OptionsContinuous.Enabled = $false
} ELSE {
If ($schedulemode -eq "Monthly"){
$JobnameObjectSchedule.OptionsDaily.Enabled = $false
$JobnameObjectSchedule.OptionsMonthly.Enabled = $true
$JobnameObjectSchedule.OptionsPeriodically.Enabled = $false
$JobnameObjectSchedule.OptionsContinuous.Enabled = $false
} ELSE {
If ($schedulemode -eq "Periodically"){
$JobnameObjectSchedule.OptionsDaily.Enabled = $false
$JobnameObjectSchedule.OptionsMonthly.Enabled = $false
$JobnameObjectSchedule.OptionsPeriodically.Enabled = $true
$JobnameObjectSchedule.OptionsContinuous.Enabled = $false
} ELSE {
If ($schedulemode -eq "Continuous"){
$JobnameObjectSchedule.OptionsDaily.Enabled = $false
$JobnameObjectSchedule.OptionsMonthly.Enabled = $false
$JobnameObjectSchedule.OptionsPeriodically.Enabled = $false
$JobnameObjectSchedule.OptionsContinuous.Enabled = $true
} ELSE {
write-host "Error: Schedulemode entry not correct"
}}}}
$JobnameObjectSchedule.OptionsDaily.Kind = $OptionsDailyAddKind
$JobnameObjectSchedule.OptionsDaily.Days = $OptionsDailyAddDays
$JobnameObjectSchedule.OptionsDaily.Time = $OptionsDailyAddTime
Set-VBRJobScheduleOptions -Job $JobnameObject -Options $JobnameObjectSchedule
If ($EnableJobAdd -eq "True"){
$JobnameObject.options.JobOptions.RunManually = $false
$JobnameObject.EnableScheduler()
} ELSE {
$JobnameObject.options.JobOptions.RunManually = $true
$JobnameObject.DisableScheduler()
}