Set-CMMaintenanceWindow
Modify a maintenance window.
Syntax
Set-CMMaintenanceWindow
[-ApplyTo <MaintenanceWindowApplyTo>]
[-ApplyToSoftwareUpdateOnly]
[-ApplyToTaskSequenceOnly]
-InputObject <IResultObject>
[-IsEnabled <Boolean>]
[-IsUtc <Boolean>]
-MaintenanceWindow <IResultObject>
[-PassThru]
[-Schedule <IResultObject>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-CMMaintenanceWindow
[-ApplyTo <MaintenanceWindowApplyTo>]
[-ApplyToSoftwareUpdateOnly]
[-ApplyToTaskSequenceOnly]
-CollectionId <String>
[-IsEnabled <Boolean>]
[-IsUtc <Boolean>]
-MaintenanceWindowName <String>
[-PassThru]
[-Schedule <IResultObject>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-CMMaintenanceWindow
[-ApplyTo <MaintenanceWindowApplyTo>]
[-ApplyToSoftwareUpdateOnly]
[-ApplyToTaskSequenceOnly]
-CollectionId <String>
[-IsEnabled <Boolean>]
[-IsUtc <Boolean>]
-MaintenanceWindow <IResultObject>
[-PassThru]
[-Schedule <IResultObject>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-CMMaintenanceWindow
[-ApplyTo <MaintenanceWindowApplyTo>]
[-ApplyToSoftwareUpdateOnly]
[-ApplyToTaskSequenceOnly]
-CollectionName <String>
[-IsEnabled <Boolean>]
[-IsUtc <Boolean>]
-MaintenanceWindowName <String>
[-PassThru]
[-Schedule <IResultObject>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-CMMaintenanceWindow
[-ApplyTo <MaintenanceWindowApplyTo>]
[-ApplyToSoftwareUpdateOnly]
[-ApplyToTaskSequenceOnly]
-CollectionName <String>
[-IsEnabled <Boolean>]
[-IsUtc <Boolean>]
-MaintenanceWindow <IResultObject>
[-PassThru]
[-Schedule <IResultObject>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-CMMaintenanceWindow
[-ApplyTo <MaintenanceWindowApplyTo>]
[-ApplyToSoftwareUpdateOnly]
[-ApplyToTaskSequenceOnly]
-InputObject <IResultObject>
[-IsEnabled <Boolean>]
[-IsUtc <Boolean>]
-MaintenanceWindowName <String>
[-PassThru]
[-Schedule <IResultObject>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Use this cmdlet to configure a maintenance window on a collection.
For more information on maintenance windows, see How to use maintenance windows in Configuration Manager.
Note
Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>
. For more information, see getting started.
Examples
Example 1: Modify a maintenance window to only apply to task sequence deployments
This command modifies the maintenance window named DiskCleanup on the collection with ID XYZ0004D. It changes the maintenance window to apply only to task sequences.
Set-CMMaintenanceWindow -Name "DiskCleanup" -CollectionID "XYZ0004D" -ApplyTo TaskSequencesOnly
Parameters
-ApplyTo
Specify the type of maintenance window:
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.
Type: | MaintenanceWindowApplyTo |
Accepted values: | Any, SoftwareUpdatesOnly, TaskSequencesOnly |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ApplyToSoftwareUpdateOnly
This parameter is deprecated. Use the ApplyTo parameter with the SoftwareUpdatesOnly value.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ApplyToTaskSequenceOnly
This parameter is deprecated. Use the ApplyTo parameter with the TaskSequencesOnly value.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-CollectionId
Specify the ID of a collection to configure a maintenance window. This ID is a standard collection ID, for example XYZ0003F
.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-CollectionName
Specify the name of a collection to configure a maintenance window.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
Add this parameter to prompt for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DisableWildcardHandling
This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ForceWildcardHandling
This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-InputObject
Specify an object for a collection to configure a maintenance window. To get this object, use the Get-CMCollection cmdlet.
Type: | IResultObject |
Aliases: | Collection, Site |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-IsEnabled
Use this parameter to configure if the maintenance window is active for the collection:
$true
: Enable the maintenance window. Deployments only run during the window's schedule.$false
: Disable the maintenance window. Deployments run at any time as configured.
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-IsUtc
To configure the maintenance window schedule to use Coordinated Universal Time (UTC), set this parameter to $true
.
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MaintenanceWindow
Specify an maintenance window object to configure. To get this object, use the Get-CMMaintenanceWindow cmdlet.
Type: | IResultObject |
Aliases: | ScheduleWindow |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-MaintenanceWindowName
Specify the name of the maintenance window to configure.
Type: | String |
Aliases: | Name |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PassThru
Add this parameter to return an object that represents the item with which you're working. By default, this cmdlet may not generate any output.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | 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
.
Type: | IResultObject |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet doesn't run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
Microsoft.ConfigurationManagement.ManagementProvider.IResultObject
Outputs
System.Object