New-VBOBackupWindowSettings
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 Pipeline Input | Accept Wildcard Characters |
---|---|---|---|---|---|
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 on common parameters, see the About CommonParameters section of Microsoft Docs.
Examples
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.
- Run the New-VBOBackupWindowSettings cmdlet to create a backup window within which the backup job is allowed to run. Save the result to the $awindow variable.
- Run the New-VBOJobSchedulePolicy cmdlet with the $awindow variable to create the job schedule. Save the result to the $daily variable.
- Run the Get-VBOJob cmdlet to get a backup job whose schedule settings you want to modify. Save the result to the $job variable.
- Run the Set-VBOJob cmdlet with the $job and $daily variables to apply new schedule settings to the backup job.
$awindow = New-VBOBackupWindowSettings -FromDay Monday -FromHour 8 -ToDay Saturday -ToHour 17 -Enabled $daily = New-VBOJobSchedulePolicy -Type Daily -DailyType Everyday -DailyTime 08:00:00 -BackupWindow $awindow $job = Get-VBOJob -Name "ABC: Sales" 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.
- Run the New-VBOBackupWindowSettings cmdlet to create a backup window within which the backup job is not allowed to run. Save the result to the $pwindow variable.
- Run the New-VBOJobSchedulePolicy cmdlet with the $pwindow variable to create the job schedule. Save the result to the $daily variable.
- Run the Get-VBOJob cmdlet to get a backup job whose schedule settings you want to modify. Save the result to the $job variable.
- Run the Set-VBOJob cmdlet with the $job and $daily variables to apply new schedule settings to the backup job.
$pwindow = New-VBOBackupWindowSettings -FromDay Monday -FromHour 8 -ToDay Monday -ToHour 17 -Enabled:$False $daily = New-VBOJobSchedulePolicy -Type Daily -DailyType Everyday -DailyTime 08:00:00 -BackupWindow $pwindow $job = Get-VBOJob -Name "ABC: Sales" 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.
- Run the Get-VBOJob cmdlet 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 the New-VBOBackupWindowSettings cmdlet to create a backup window. Save the result to the $bw variable.
- Run the Set-VBOJobSchedulePolicy cmdlet with the $bw variable to modify the job schedule settings. Save the result to the $newschedule variable.
- Run the Set-VBOJob cmdlet with the $job and $newschedule variables to apply new schedule settings to the backup job.
$job = Get-VBOJob -Name "ABC: Sales" $schedule = $job.schedulepolicy $bw = New-VBOBackupWindowSettings -FromDay Friday -FromHour 2 -ToDay Monday -ToHour 3 -Enabled $newschedule = Set-VBOJobSchedulePolicy -Policy $schedule -BackupWindowEnabled -BackupWindow $ww Set-VBOJob -Job $job -SchedulePolicy $newschedule |
Related Commands