Use this cmdlet to create a maintenance window for a collection.
Maintenance windows are recurring periods of time when the Configuration Manager client can run tasks. For example, apply software updates or install software.
This window makes sure that significant system changes only happen at times that don't affect productivity and uptime.
Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>. For more information, see getting started.
Examples
Example 1: Create a maintenance window
The first command uses the New-CMSchedule cmdlet to create a schedule object, and then stores it in the $MWSchedule variable.
The second command creates a maintenance window named MonthlySchedule for the specified collection.
The maintenance window uses the schedule stored in the $MWSchedule variable.
Example 2: Copy a maintenance window between collections
The first command gets a maintenance window from the collection with ID XYZ0003F. It then creates a maintenance window on the collection with ID XYZ0005D with the same name, same schedule, and only for software updates.
Any: The maintenance window applies to all deployments.
SoftwareUpdatesOnly: The maintenance window only applies to software update deployments.
TaskSequencesOnly: The maintenance window only applies to task sequence deployments.
If you don't specify this parameter, Any is the default.
Parameter properties
Type:
MaintenanceWindowApplyTo
Default value:
None
Accepted values:
Any, SoftwareUpdatesOnly, TaskSequencesOnly
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
-ApplyToSoftwareUpdateOnly
This parameter is deprecated. Use the ApplyTo parameter with the SoftwareUpdatesOnly value.
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
-ApplyToTaskSequenceOnly
This parameter is deprecated. Use the ApplyTo parameter with the TaskSequencesOnly value.
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
-CollectionId
Specify the ID of a collection to add the maintenance window. This ID is a standard collection ID, for example XYZ0003F.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByCollectionId
Position:
0
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-CollectionName
Specify the name of a collection to add the maintenance window.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByCollectionName
Position:
0
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Confirm
Add this parameter to prompt for confirmation before running the cmdlet.
Parameter properties
Type:
SwitchParameter
Default value:
False
Supports wildcards:
False
DontShow:
False
Aliases:
cf
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-DisableWildcardHandling
This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.
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
-ForceWildcardHandling
This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.
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
-InputObject
Specify an object for a collection to add the maintenance window. To get this object, use the Get-CMCollection cmdlet.
Parameter properties
Type:
IResultObject
Default value:
None
Supports wildcards:
False
DontShow:
False
Aliases:
Collection, Site
Parameter sets
ByValue
Position:
0
Mandatory:
True
Value from pipeline:
True
Value from pipeline by property name:
False
Value from remaining arguments:
False
-IsEnabled
To create a maintenance window on a collection, but not have it active, set this parameter to $false. If you don't include this parameter, this cmdlet enables the maintenance window.
Parameter properties
Type:
Boolean
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
-IsUtc
To configure the maintenance window schedule to use Coordinated Universal Time (UTC), set this parameter to $true. If you don't include this parameter, the schedule uses local time.
Parameter properties
Type:
Boolean
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
-Name
Specify the name of the maintenance window.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Aliases:
MaintenanceWindowName
Parameter sets
(All)
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Schedule
Specify a schedule object for when the maintenance window occurs. To get this object, use the New-CMSchedule cmdlet.
The maintenance window object stores the schedule as a token string. To copy a schedule from another object, use the Convert-CMSchedule cmdlet. For example, Convert-CMSchedule -ScheduleString $mw1.ServiceWindowSchedules.
Parameter properties
Type:
IResultObject
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet doesn't run.
Parameter properties
Type:
SwitchParameter
Default value:
False
Supports wildcards:
False
DontShow:
False
Aliases:
wi
Parameter sets
(All)
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.