New-SCServicingWindow
New-SCServicingWindow
Creates a servicing window and the schedule for the servicing window.
Syntax
Parameter Set: DailyFrequency
New-SCServicingWindow [-Name] <String> -DaysToRecur <Int32> [-Category <String> ] [-Description <String> ] [-JobVariable <String> ] [-MinutesDuration <Int32> ] [-Owner <String> ] [-PROTipID <Guid> ] [-RunAsynchronously] [-StartDate <DateTime> ] [-StartTimeOfDay <DateTime> ] [-TimeZone <Int32> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]
Parameter Set: MonthlyFrequency
New-SCServicingWindow [-Name] <String> -DayOfMonth <DayOfMonthType> {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} [-Category <String> ] [-Description <String> ] [-JobVariable <String> ] [-MinutesDuration <Int32> ] [-MonthsToRecur <Int32> ] [-Owner <String> ] [-PROTipID <Guid> ] [-RunAsynchronously] [-StartDate <DateTime> ] [-StartTimeOfDay <DateTime> ] [-TimeZone <Int32> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]
Parameter Set: MonthlyRelativeFrequency
New-SCServicingWindow [-Name] <String> -MonthlyScheduleDayOfWeek <DayOfWeek> {Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday} -WeekOfMonth <WeekOfMonthType> {First | Second | Third | Fourth | Last} [-Category <String> ] [-Description <String> ] [-JobVariable <String> ] [-MinutesDuration <Int32> ] [-MonthsToRecur <Int32> ] [-Owner <String> ] [-PROTipID <Guid> ] [-RunAsynchronously] [-StartDate <DateTime> ] [-StartTimeOfDay <DateTime> ] [-TimeZone <Int32> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]
Parameter Set: WeeklyFrequency
New-SCServicingWindow [-Name] <String> -WeeklyScheduleDayOfWeek <String> [-Category <String> ] [-Description <String> ] [-JobVariable <String> ] [-MinutesDuration <Int32> ] [-Owner <String> ] [-PROTipID <Guid> ] [-RunAsynchronously] [-StartDate <DateTime> ] [-StartTimeOfDay <DateTime> ] [-TimeZone <Int32> ] [-VMMServer <ServerConnection> ] [-WeeksToRecur <Int32> ] [ <CommonParameters>]
Detailed Description
The New-SCServicingWindow cmdlet creates a serviding 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.
Parameters
-Category<String>
Specifies a category for a servicing window.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-DayOfMonth<DayOfMonthType>
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 through 31.
Valid string values: "First", "Last"
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-DaysToRecur<Int32>
Specifies, in days, the amount of time between scheduled jobs.
Minimum value: 1
Maximum value: 999
Default value: 1
Example format (to schedule a job to recur every third day): -DaysToRecur 3
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Description<String>
States a description for the specified object.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-JobVariable<String>
Specifies that job progress is tracked and stored in the variable named by this parameter.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-MinutesDuration<Int32>
Specifies, in minutes, a period of time. For example, when used with New-SCServicingWindow or Set-SCServicingWindow, use this parameter to specify the amount of time for which to put a server or service into maintenance mode.
Example format: -DurationMinutes 120
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-MonthlyScheduleDayOfWeek<DayOfWeek>
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). Valid values to specify a specific day are: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.
Requirement: Use with the parameter WeekOfMonth.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-MonthsToRecur<Int32>
Specifies, in months, the amount of time between scheduled service windows
Minimum value: 1
Maximum value: None
Default value: 1
Example format (to schedule a service window to recur every other month): -MonthsToRecur 2
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Name<String>
Specifies the name of a VMM object.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-Owner<String>
Specifies the owner of a VMM object in the form of a valid domain user account.
Example format: -Owner "Contoso\ReneeLo"
Example format: -Owner "ReneeLo@Contoso"
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-PROTipID<Guid>
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-RunAsynchronously
Indicates that the job runs asynchronously so that control returns to the command shell immediately.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-StartDate<DateTime>
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 Date-Time object from Get-Date.
Example format that specifies a DateTime object:
$StartDate = Get-Date -Year 2012 -Day 5 -Month 4
-StartDate $StartDate
Example formats that specifies a string:
-StartDate “August 19, 2011”
-StartDate “8/19/2011”
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-StartTimeOfDay<DateTime>
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.
Example format: -StartTimeOfDay “08:00”
Example format for 2 hrs from 6:00pm: -StartTimeOfDay "18:00-20:00"
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-TimeZone<Int32>
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: https://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.
Example format to specify the GMT Standard Time zone: -TimeZone 085
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-VMMServer<ServerConnection>
Specifies a VMM server object.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-WeeklyScheduleDayOfWeek<String>
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
Example format: -WeeklyScheduleDayOfWeek “Monday”
Example format: -WeeklyScheduleDayOfWeek “Monday, Wednesday, Friday”
Example format: -WeeklyScheduleDayOfWeek 5 (to specify a Friday)
Requirement: Use with StartTimeOfDay.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-WeekOfMonth<WeekOfMonthType>
Specifies a week relative to the first day of the month, such as first, second, third, fourth, or last.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-WeeksToRecur<Int32>
Specifies, in weeks, the amount of time between scheduled jobs.
Minimum value: 1
Maximum value: None
Default value: 1
Example format (to schedule a job to recur every other week): -WeeksToRecur 2
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
- ServicingWindow
Examples
1: Schedule a daily servicing window.
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.
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
2: Schedule a servicing window that occurs one day a week.
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).
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
3: Schedule a biweekly service window.
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.
PS C:\> New-SCServicingWindow -Name "Staging Group C" -StartTimeOfDay "22:30" -TimeZone 035 -WeeklyScheduleDayOfWeek "Saturday, Sunday" -WeeksToRecur 2
4: Schedule a bimonthly servicing window.
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.
PS C:\> New-SCServicingWindow -Name "Production Servers A" -Category "Emergency" -StartTimeOfDay "23:30" -TimeZone 085 -MonthlyScheduleDayOfWeek "Tuesday" -WeekOfMonth "Second" -MonthsToRecur 2