Remove-CMMaintenanceWindow

Remove a maintenance window.

Syntax

Remove-CMMaintenanceWindow
      [-Force]
      [-InputObject] <IResultObject>
      -MaintenanceWindowName <String>
      [-DisableWildcardHandling]
      [-ForceWildcardHandling]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMMaintenanceWindow
      [-CollectionId] <String>
      [-Force]
      -MaintenanceWindowName <String>
      [-DisableWildcardHandling]
      [-ForceWildcardHandling]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMMaintenanceWindow
      [-CollectionName] <String>
      [-Force]
      -MaintenanceWindowName <String>
      [-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.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-CollectionName

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

Type:String
Position:0
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

-Force

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

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 from which to remove the maintenance window. To get this object, use the Get-CMCollection cmdlet.

Type:IResultObject
Aliases:Collection, Site
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-MaintenanceWindowName

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

You can use wildcard characters:

  • *: Multiple characters
  • ?: Single character
Type:String
Aliases:Name
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:True

-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