Short Description
Creates a backup window.
Syntax
New-VBOBackupWindowSettings -FromDay <DayOfWeek> {Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday} -FromHour <int> -ToDay <DayOfWeek> {Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday} -ToHour <int> -Enabled [<CommonParameters>] |
Detailed Description
This cmdlet creates a backup window for a backup job. The backup window sets a time period within which the job must be completed.
You can use a backup window object when creating or modifying backup job schedule settings.
Parameters
Parameter | Description | Required | Position | Accept | Accept |
FromDay | Specifies the day of the week on which the backup window opens. | True | Named | False | False |
FromHour | Specifies the hour on which the backup window opens. | True | Named | False | False |
ToDay | Specifies the day of the week on which the backup window ends. | True | Named | False | False |
ToHour | Specifies the hour on which the backup window ends. | True | Named | False | False |
Enabled | Indicates that the cmdlet will create a backup window with allowed backup hours. If this parameter is set to False, the cmdlet will create a backup window with prohibited backup hours. | True | Named | False | False |
<CommonParameters>
This cmdlet supports Microsoft PowerShell common parameters. For more information about common parameters, see http://go.microsoft.com/fwlink/p/?LinkID=113216.
Example 1
This example shows how to create a backup window with allowed backup hours from 8 AM on Monday to 5 PM on Saturday and add it to the new job schedule.
You will need to perform the following steps:
- Run New-VBOBackupWindowSettings to create a backup window within which the backup job is allowed to run. Save the result to the $awindow variable.
- Run New-VBOJobSchedulePolicy with the $awindow variable to create the job schedule. Save the result to the $daily variable.
- Run Get-VBOJob to get a backup job whose schedule settings you want to modify. Save the result to the $job variable.
- Run Set-VBOJob with the $job and $daily variables to apply new schedule settings to the backup job.
PS C:\PS> $awindow = New-VBOBackupWindowSettings -FromDay Monday -FromHour 8 -ToDay Saturday -ToHour 17 -Enabled PS C:\PS> $daily = New-VBOJobSchedulePolicy -Type Daily -DailyType Everyday -DailyTime 08:00:00 -BackupWindow $awindow PS C:\PS> $job = Get-VBOJob -Name "ABC: Sales" PS C:\PS> Set-VBOJob -Job $job -SchedulePolicy $daily |
Example 2
This example shows how to create a backup window with prohibited backup hours from 8 AM to 5 PM on Monday and add it to the new job schedule.
You will need to perform the following steps:
- Run New-VBOBackupWindowSettings to create a backup window within which the backup job is not allowed to run. Save the result to the $pwindow variable.
- Run New-VBOJobSchedulePolicy with the $pwindow variable to create the job schedule. Save the result to the $daily variable.
- Run Get-VBOJob to get a backup job whose schedule settings you want to modify. Save the result to the $job variable.
- Run Set-VBOJob with the $job and $daily variables to apply new schedule settings to the backup job.
PS C:\PS> $pwindow = New-VBOBackupWindowSettings -FromDay Monday -FromHour 8 -ToDay Monday -ToHour 17 -Enabled:$False PS C:\PS> $daily = New-VBOJobSchedulePolicy -Type Daily -DailyType Everyday -DailyTime 08:00:00 -BackupWindow $pwindow PS C:\PS> $job = Get-VBOJob -Name "ABC: Sales" PS C:\PS> Set-VBOJob -Job $job -SchedulePolicy $daily |
Example 3
This example shows how to create a backup window and add it to the existing job schedule.
You will need to perform the following steps:
- Run Get-VBOJob to get a backup job whose schedule settings you want to modify. Save the result to the $job variable.
- Get the job schedule settings. Use the SchedulePolicy property of the job object saved to the $job variable. Save the result to the $schedule variable.
- Run New-VBOBackupWindowSettings to create a backup window. Save the result to the $bw variable.
- Run Set-VBOJobSchedulePolicy with the $bw variable to modify the job schedule settings. Save the result to the $newschedule variable.
- Run Set-VBOJob with the $job and $newschedule variables to apply new schedule settings to the backup job.
PS C:\PS> $job = Get-VBOJob -Name "ABC: Sales" PS C:\PS> $schedule = $job.schedulepolicy PS C:\PS> $bw = New-VBOBackupWindowSettings -FromDay Friday -FromHour 2 -ToDay Monday -ToHour 3 -Enabled PS C:\PS> $newschedule = Set-VBOJobSchedulePolicy -Policy $schedule -BackupWindowEnabled -BackupWindow $ww PS C:\PS> Set-VBOJob -Job $job -SchedulePolicy $newschedule |
Related Commands