Partager via


New-SCServicingWindow

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

Syntax

New-SCServicingWindow
   [-VMMServer <ServerConnection>]
   [-Name] <String>
   [-Description <String>]
   [-Category <String>]
   [-Owner <String>]
   [-TimeZone <Int32>]
   [-StartDate <DateTime>]
   [-StartTimeOfDay <DateTime>]
   -WeeklyScheduleDayOfWeek <String>
   [-WeeksToRecur <Int32>]
   [-MinutesDuration <Int32>]
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [<CommonParameters>]
New-SCServicingWindow
   [-VMMServer <ServerConnection>]
   [-Name] <String>
   [-Description <String>]
   [-Category <String>]
   [-Owner <String>]
   [-TimeZone <Int32>]
   [-StartDate <DateTime>]
   [-StartTimeOfDay <DateTime>]
   -MonthlyScheduleDayOfWeek <DayOfWeek>
   -WeekOfMonth <WeekOfMonthType>
   [-MonthsToRecur <Int32>]
   [-MinutesDuration <Int32>]
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [<CommonParameters>]
New-SCServicingWindow
   [-VMMServer <ServerConnection>]
   [-Name] <String>
   [-Description <String>]
   [-Category <String>]
   [-Owner <String>]
   [-TimeZone <Int32>]
   [-StartDate <DateTime>]
   [-StartTimeOfDay <DateTime>]
   -DayOfMonth <DayOfMonthType>
   [-MonthsToRecur <Int32>]
   [-MinutesDuration <Int32>]
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [<CommonParameters>]
New-SCServicingWindow
   [-VMMServer <ServerConnection>]
   [-Name] <String>
   [-Description <String>]
   [-Category <String>]
   [-Owner <String>]
   [-TimeZone <Int32>]
   [-StartDate <DateTime>]
   [-StartTimeOfDay <DateTime>]
   -DaysToRecur <Int32>
   [-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.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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
Type:DayOfMonthType
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
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters: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.

Type:Int32
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Description

Specifies a description for the servicing window.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-JobVariable

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:DayOfWeek
Accepted values:Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters: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.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

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

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Owner

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RunAsynchronously

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

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:DateTime
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:DateTime
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VMMServer

Specifies a VMM server object.

Type:ServerConnection
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters: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
Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WeekOfMonth

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

Type:WeekOfMonthType
Accepted values:First, Second, Third, Fourth, Last
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters: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.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

ServicingWindow

This cmdlet returns a ServicingWindow object.