New-CMMaintenanceWindow

Creates a maintenance window for a collection.

Syntax

New-CMMaintenanceWindow
   [-CollectionId] <String>
   [-ApplyTo <MaintenanceWindowApplyTo>]
   [-ApplyToSoftwareUpdateOnly]
   [-ApplyToTaskSequenceOnly]
   [-Confirm]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-IsEnabled <Boolean>]
   -Name <String>
   -Schedule <IResultObject>
   [-WhatIf]
   [<CommonParameters>]
New-CMMaintenanceWindow [-CollectionName]  [-ApplyTo ]
 [-ApplyToSoftwareUpdateOnly] [-ApplyToTaskSequenceOnly] [-Confirm] [-DisableWildcardHandling]
 [-ForceWildcardHandling] [-IsEnabled ] -Name  -Schedule  [-WhatIf]
 []
New-CMMaintenanceWindow [-InputObject]  [-ApplyTo ]
 [-ApplyToSoftwareUpdateOnly] [-ApplyToTaskSequenceOnly] [-Confirm] [-DisableWildcardHandling]
 [-ForceWildcardHandling] [-IsEnabled ] -Name  -Schedule  [-WhatIf]
 []

Description

The New-CMMaintenanceWindow cmdlet creates a maintenance window for a collection. Maintenance windows are periods of time reserved for write operations such as applying software updates, installing software, or configuring computer settings.

Examples

Example 1: Create a maintenance window

PS C:\> $MWSchedule = New-CMSchedule -DayOfWeek Friday -DurationCount 0 -DurationInterval Hours -RecurCount 1 -Start "10/12/2013 21:00:00"
PS C:\> New-CMMaintenanceWindow -CollectionID "AAA0005D" -Name "MonthlySchedule" -Schedule $MWSchedule

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.

Required Parameters

-CollectionId

Specifies the ID of the collection that the maintenance window applies to.

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

Specifies the input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet.

Type:IResultObject
Aliases:Collection
Required:True
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-Name

Specifies the name of the maintenance window.

Type:String
Aliases:MaintenanceWindowName
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Schedule

Specifies a CMSchedule object. The schedule specifies when the maintenance window occurs. To create a CMSchedule object, use the New-CMSchedule cmdlet.

Type:IResultObject
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Optional Parameters

-ApplyTo
Type:MaintenanceWindowApplyTo
Parameter Sets:Any, SoftwareUpdatesOnly, TaskSequencesOnly
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ApplyToSoftwareUpdateOnly

Indicates that the maintenance window is used to apply software updates only.

Type:SwitchParameter
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ApplyToTaskSequenceOnly

Indicates that the maintenance window is used to apply task sequences only.

Type:SwitchParameter
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Required:False
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-DisableWildcardHandling

Indicates that wildcard handling is disabled.

Type:SwitchParameter
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ForceWildcardHandling

Indicates that wildcard handling is enabled.

Type:SwitchParameter
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-IsEnabled
Type:Boolean
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Required:False
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False