Export (0) Print
Expand All
Expand Minimize

New-MaintenanceWindow

New-MaintenanceWindow

Puts the specified monitoring object into maintenance mode.

Syntax

Parameter Set: FromMonitoringObjectProviderPath
New-MaintenanceWindow [-StartTime] <DateTime> [-EndTime] <DateTime> [[-Reason] <MaintenanceModeReason> ] [-Comment] <String> [[-Path] <String[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: FromMonitoringObject
New-MaintenanceWindow [-StartTime] <DateTime> [-EndTime] <DateTime> [[-Reason] <MaintenanceModeReason> ] [-Comment] <String> [-MonitoringObject] <MonitoringObject> [-Confirm] [-WhatIf] [ <CommonParameters>]




Detailed Description

Puts the specified monitoring object into maintenance mode.

Parameters

-Comment<String>

Specifies comments about the maintenance.


Aliases

none

Required?

true

Position?

4

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-EndTime<DateTime>

Specifies the UTC time the maintenance will end. NOTE: This value is assumed to be UTC time. If the Kind property of the supplied DateTime value is set to "Local", this value will be converted to UTC time automatically.


Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-MonitoringObject<MonitoringObject>

Specifies the monitoring object to put into maintenance mode. You can use Get-MonitoringObject to retrieve an object to use as the value of this parameter.


Aliases

none

Required?

true

Position?

5

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Path<String[]>

Specifies the path or paths to monitoring objects to put into maintenance mode. To enter multiple paths, separate them by using commas.


Aliases

none

Required?

false

Position?

6

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Reason<MaintenanceModeReason>

Specifies the reason for the maintenance. The valid values are: PlannedOther, UnplannedOther, PlannedHardwareMaintenance, UnplannedHardwareMaintenance, PlannedHardwareInstallation, UnplannedHardwareInstallation, PlannedOperatingSystemReconfiguration, UnplannedOperatingSystemReconfiguration, PlannedApplicationMaintenance, ApplicationInstallation, ApplicationUnresponsive, ApplicationUnstable, SecurityIssue, LossOfNetworkConnectivity. These values are not case-sensitive.The following lists the acceptable values for this parameter:


Aliases

none

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-StartTime<DateTime>

Specifies the UTC time the maintenance will begin. NOTE: This value is assumed to be UTC time. If the Kind property of the supplied DateTime value is set to "Local", this value will be converted to UTC time automatically.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before executing the command.


Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Describes what would happen if you executed the command without actually executing the command.


Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters

Notes

  • For more information, type "Get-Help New-MaintenanceWindow -detailed". For technical information, type "Get-Help New-MaintenanceWindow -full".
    When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".

Examples

-------------- EXAMPLE 1 --------------

This command puts the current monitoring object into maintenance mode. The maintenance is set to begin on 11/26/2007 and end on 11/27/2007 and a reason and comment are noted. The time strings are first converted to Universal Time Coordinated (UTC) before being passed as parameter values. Note that instead of using the current location within the monitoring provider to specify the monitoring object, you could provide the path to the object explicitly by using the Path parameter.


C:\PS>[DateTime] $starttime = “11/26/2006”$starttime = $starttime.ToUniversalTime()[DateTime] $endtime= “11/27/2006”$endtime = $endtime.ToUniversalTime()new-maintenancewindow -starttime $starttime -endtime $endtime -reason UnplannedOther -comment "Service Pack"

-------------- EXAMPLE 2 --------------

This example creates a new maintenance window that starts now and ends one day from now.


C:\PS>$time = [DateTime]::NowNew-MaintenanceWindow -starttime: ($time) -endTime: ($time.AddDays(1)) -reason: "ApplicationInstallation" -comment: "Testing DateTime.Now"

Related topics

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft