Compartilhar via


New-SCServicingWindow

Creates a servicing window and the schedule for the servicing window.

Syntax

WeeklyFrequency

New-SCServicingWindow
    [-Name] <String>
    -WeeklyScheduleDayOfWeek <String>
    [-VMMServer <ServerConnection>]
    [-Description <String>]
    [-Category <String>]
    [-Owner <String>]
    [-TimeZone <Int32>]
    [-StartDate <DateTime>]
    [-StartTimeOfDay <DateTime>]
    [-WeeksToRecur <Int32>]
    [-MinutesDuration <Int32>]
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [<CommonParameters>]

MonthlyRelativeFrequency

New-SCServicingWindow
    [-Name] <String>
    -MonthlyScheduleDayOfWeek <DayOfWeek>
    -WeekOfMonth <WeekOfMonthType>
    [-VMMServer <ServerConnection>]
    [-Description <String>]
    [-Category <String>]
    [-Owner <String>]
    [-TimeZone <Int32>]
    [-StartDate <DateTime>]
    [-StartTimeOfDay <DateTime>]
    [-MonthsToRecur <Int32>]
    [-MinutesDuration <Int32>]
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [<CommonParameters>]

MonthlyFrequency

New-SCServicingWindow
    [-Name] <String>
    -DayOfMonth <DayOfMonthType>
    [-VMMServer <ServerConnection>]
    [-Description <String>]
    [-Category <String>]
    [-Owner <String>]
    [-TimeZone <Int32>]
    [-StartDate <DateTime>]
    [-StartTimeOfDay <DateTime>]
    [-MonthsToRecur <Int32>]
    [-MinutesDuration <Int32>]
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [<CommonParameters>]

DailyFrequency

New-SCServicingWindow
    [-Name] <String>
    -DaysToRecur <Int32>
    [-VMMServer <ServerConnection>]
    [-Description <String>]
    [-Category <String>]
    [-Owner <String>]
    [-TimeZone <Int32>]
    [-StartDate <DateTime>]
    [-StartTimeOfDay <DateTime>]
    [-MinutesDuration <Int32>]
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [<CommonParameters>]

Description

The New-SCServicingWindow cmdlet creates a servicing window and the schedule for the servicing window. A servicing window is a scheduled timeframe during which maintenance work can be done on a virtual machine, a host, or a service.

Examples

Example 1: Schedule a daily servicing window

PS C:\> $Date = (Get-Date).AddDays(2)
PS C:\> New-SCServicingWindow -Name "Backup Staging A" -Category "Non Essential" -StartDate $Date -StartTimeOfDay "13:30" -TimeZone 085 -DaysToRecur 3

The first command gets the current date and adds two days, then stores the result in the $Date variable.

The second command creates a servicing window named Backup Staging A that occurs every third day at 1:30 PM in the GMT Standard time zone. The start date of the servicing window is set to the date stored in $Date, which is in two days.

Example 2: Schedule a servicing window that occurs one day a week

PS C:\> $Date = (Get-Date).AddDays(7)
PS C:\> New-SCServicingWindow -Name "Test Servers Group 3" -Category "Test Group" -StartDate $Date -StartTimeOfDay "11:00" -TimeZone 035 -WeeklyScheduleDayOfWeek "Saturday" -WeeksToRecur 1 -MinutesDuration 180

The first command gets the current date and adds seven days (one week), then stores the result in the $Date variable.

The second command creates a servicing window named Test Servers Group 3 that occurs weekly on Saturday starting at 11:00 AM in the Eastern time zone and and lasts for 3 hours (180 minutes). The start date of the servicing window is set to the date stored in $Date, which is in seven days (one week).

Example 3: Schedule a biweekly service window

PS C:\> New-SCServicingWindow -Name "Staging Group C" -StartTimeOfDay "22:30" -TimeZone 035 -WeeklyScheduleDayOfWeek "Saturday, Sunday" -WeeksToRecur 2

This command creates a servicing window named Staging Group C that occurs every other week (biweekly) on Saturday and Sunday starting at 10:30 PM in the Eastern time zone. Because no start date is specified, by default the servicing window becomes effective today.

Example 4: Schedule a bimonthly servicing window

PS C:\> New-SCServicingWindow -Name "Production Servers A" -Category "Emergency" -StartTimeOfDay "23:30" -TimeZone 085 -MonthlyScheduleDayOfWeek "Tuesday" -WeekOfMonth "Second" -MonthsToRecur 2

This command creates a servicing window named Production Servers A that occurs every other month (bimonthly) on the second Tuesday of the month, starting at 11:30 PM in the Eastern time zone. Because no start date is specified, by default the servicing window becomes effective today.

Parameters

-Category

Specifies a category for a servicing window.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DayOfMonth

Specifies the ordinal day of the month on which the schedule starts. For example, 4 indicates the fourth day of the month. Last indicates the last day of the month.

The default value is the integer that corresponds to the same day as specified in the StartDate parameter.

  • Valid integer values: 1 - 31
  • Valid string values: First, Last

Parameter properties

Type:DayOfMonthType
Default value:None
Accepted values:First, DayTwo, DayThree, DayFour, DayFive, DaySix, DaySeven, DayEight, DayNine, DayTen, DayEleven, DayTweleve, DayThirteen, DayFourteen, DayFifteen, DaySixteen, DaySeventeen, DayEighteen, DayNineteen, DayTwenty, DayTwentyOne, DayTwentyTwo, DayTwentyThree, DayTwentyFour, DayTwentyFive, DayTwentySix, DayTwentySeven, DayTwentyEight, DayTwentyNine, DayThirty, DayThirtyOne, Last
Supports wildcards:False
DontShow:False

Parameter sets

MonthlyFrequency
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DaysToRecur

Specifies the amount of time, in days, between scheduled jobs. The default value is the minimum value of one (1). The maximum value is 999.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

DailyFrequency
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Description

Specifies a description for the servicing window.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-JobVariable

Specifies that job progress is tracked and stored in the variable named by this parameter.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MinutesDuration

Specifies a period of time in minutes. Use this parameter to specify the amount of time for which to put a server or service into maintenance mode.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MonthlyScheduleDayOfWeek

Specifies the day of the week to run a job that occurs on a monthly schedule. You can specify only one day of the week. The default value is the current day (if today is Tuesday, Tuesday is the default). The acceptable values for this parameter are:

  • Monday
  • Tuesday
  • Wednesday
  • Thursday
  • Friday
  • Saturday
  • Sunday

Requirement: Use with the WeekOfMonth parameter.

Parameter properties

Type:DayOfWeek
Default value:None
Accepted values:Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
Supports wildcards:False
DontShow:False

Parameter sets

MonthlyRelativeFrequency
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MonthsToRecur

Specifies the amount of time, in months, between scheduled service windows. The default value is the minimum value of 1. There is no maximum value.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

MonthlyRelativeFrequency
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
MonthlyFrequency
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies the name of a Virtual Machine Manager (VMM) object.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Owner

Specifies the owner of a VMM object in the form of a valid domain user account.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PROTipID

Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit PRO tips.

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-StartDate

Specifies the date to start a service window. The default value is the current date. You can type a new date in the short date format for your locale, or, you can pass a DateTime object from Get-Date.

Parameter properties

Type:DateTime
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-StartTimeOfDay

Specifies the time of day, or a time-span during a 24-hour period, to start a job or other operation. The default value is the current time.

Parameter properties

Type:DateTime
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TimeZone

Specifies a number (an index) that identifies a geographical region that shares the same standard time. For a list of time zone indexes, see Microsoft Time Zone Index Values at http://go.microsoft.com/fwlink/?LinkId=120935. If no time zone is specified, the default time zone used for a virtual machine is the same time zone setting that is on the virtual machine host.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VMMServer

Specifies a VMM server object.

Parameter properties

Type:ServerConnection
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-WeeklyScheduleDayOfWeek

Specifies one or more days of the week to run a job. The default value is the current day of the week.

  • Valid values to specify an individual day by using a string: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.
  • Valid values to specify a set of days in a week: Any set of two or more days separated by commas.
  • Valid values to specify an individual day by using an integer: 1, 2, 3, 4, 5, 6, 7

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

WeeklyFrequency
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WeekOfMonth

Specifies a week relative to the first day of the month, such as first, second, third, fourth, or last.

Parameter properties

Type:WeekOfMonthType
Default value:None
Accepted values:First, Second, Third, Fourth, Last
Supports wildcards:False
DontShow:False

Parameter sets

MonthlyRelativeFrequency
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WeeksToRecur

Specifies the amount of time, in weeks, between scheduled jobs. The default value is the minimum value of one (1). There is no maximum value.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

WeeklyFrequency
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

ServicingWindow

This cmdlet returns a ServicingWindow object.