Edit

Share via


Remove-CMMaintenanceWindow

Remove a maintenance window.

Syntax

ByValue (Default)

Remove-CMMaintenanceWindow
    [-InputObject] <IResultObject>
    -MaintenanceWindowName <String>
    [-Force]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByCollectionId

Remove-CMMaintenanceWindow
    [-CollectionId] <String>
    -MaintenanceWindowName <String>
    [-Force]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByCollectionName

Remove-CMMaintenanceWindow
    [-CollectionName] <String>
    -MaintenanceWindowName <String>
    [-Force]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Use this cmdlet to remove a maintenance window from 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: Remove a maintenance window by name from a collection by ID

This command removes the maintenance window named Distribution Point Maintenance. The window is on the collection with ID XYZ0004D.

Remove-CMMaintenanceWindow -Name "Distribution Point Maintenance" -CollectionId "XYZ0004D"

Example 2: Remove all maintenance windows on a collection

This example first gets a collection object, and then uses the wildcard character to remove all windows without prompting for confirmation.

$coll = Get-CMCollection -CollectionId "XYZ0003f"
Remove-CMMaintenanceWindow -InputObject $coll -MaintenanceWindowName "*" -Force

Parameters

-CollectionId

Specify the ID of a collection from which to remove 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 from which to remove 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

-Force

Add this parameter to force the command to run without asking for user confirmation.

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 from which to remove 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

-MaintenanceWindowName

Specify the name of a maintenance window to remove from the targeted collection.

You can use wildcard characters:

  • *: Multiple characters
  • ?: Single character

Parameter properties

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

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.

Inputs

Microsoft.ConfigurationManagement.ManagementProvider.IResultObject

Outputs

System.Object