Edit

Share via


Set-CMMaintenanceWindow

Modify a maintenance window.

Syntax

ByValueMWValue (Default)

Set-CMMaintenanceWindow
    -InputObject <IResultObject>
    -MaintenanceWindow <IResultObject>
    [-ApplyTo <MaintenanceWindowApplyTo>]
    [-ApplyToSoftwareUpdateOnly]
    [-ApplyToTaskSequenceOnly]
    [-IsEnabled <Boolean>]
    [-IsUtc <Boolean>]
    [-PassThru]
    [-Schedule <IResultObject>]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByCollectionIdMWName

Set-CMMaintenanceWindow
    -CollectionId <String>
    -MaintenanceWindowName <String>
    [-ApplyTo <MaintenanceWindowApplyTo>]
    [-ApplyToSoftwareUpdateOnly]
    [-ApplyToTaskSequenceOnly]
    [-IsEnabled <Boolean>]
    [-IsUtc <Boolean>]
    [-PassThru]
    [-Schedule <IResultObject>]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByCollectionIdMWValue

Set-CMMaintenanceWindow
    -CollectionId <String>
    -MaintenanceWindow <IResultObject>
    [-ApplyTo <MaintenanceWindowApplyTo>]
    [-ApplyToSoftwareUpdateOnly]
    [-ApplyToTaskSequenceOnly]
    [-IsEnabled <Boolean>]
    [-IsUtc <Boolean>]
    [-PassThru]
    [-Schedule <IResultObject>]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByCollectionNameMWName

Set-CMMaintenanceWindow
    -CollectionName <String>
    -MaintenanceWindowName <String>
    [-ApplyTo <MaintenanceWindowApplyTo>]
    [-ApplyToSoftwareUpdateOnly]
    [-ApplyToTaskSequenceOnly]
    [-IsEnabled <Boolean>]
    [-IsUtc <Boolean>]
    [-PassThru]
    [-Schedule <IResultObject>]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByCollectionNameMWValue

Set-CMMaintenanceWindow
    -CollectionName <String>
    -MaintenanceWindow <IResultObject>
    [-ApplyTo <MaintenanceWindowApplyTo>]
    [-ApplyToSoftwareUpdateOnly]
    [-ApplyToTaskSequenceOnly]
    [-IsEnabled <Boolean>]
    [-IsUtc <Boolean>]
    [-PassThru]
    [-Schedule <IResultObject>]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByValueMWName

Set-CMMaintenanceWindow
    -InputObject <IResultObject>
    -MaintenanceWindowName <String>
    [-ApplyTo <MaintenanceWindowApplyTo>]
    [-ApplyToSoftwareUpdateOnly]
    [-ApplyToTaskSequenceOnly]
    [-IsEnabled <Boolean>]
    [-IsUtc <Boolean>]
    [-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.

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 configure a 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

ByCollectionIdMWName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByCollectionIdMWValue
Position:Named
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 configure a maintenance window.

Parameter properties

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

Parameter sets

ByCollectionNameMWName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByCollectionNameMWValue
Position:Named
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 configure a 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

ByValueMWValue
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False
ByValueMWName
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments: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.

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.

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

-MaintenanceWindow

Specify an maintenance window object to configure. To get this object, use the Get-CMMaintenanceWindow cmdlet.

Parameter properties

Type:IResultObject
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ScheduleWindow

Parameter sets

ByValueMWValue
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False
ByCollectionIdMWValue
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False
ByCollectionNameMWValue
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-MaintenanceWindowName

Specify the name of the maintenance window to configure.

Parameter properties

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

Parameter sets

ByCollectionIdMWName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByCollectionNameMWName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByValueMWName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

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

-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:False
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.

Inputs

Microsoft.ConfigurationManagement.ManagementProvider.IResultObject

Outputs

System.Object