Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Set-SCOMMaintenanceMode

Updated: January 26, 2014

Applies To: System Center 2012 R2 Operations Manager

Set-SCOMMaintenanceMode

Updates active maintenance mode entries.

Syntax

Parameter Set: FromMaintananceWindow
Set-SCOMMaintenanceMode [-MaintenanceModeEntry] <MaintenanceWindow[]> [-EndTime] <DateTime> [[-Comment] <String> ] [[-Reason] <MaintenanceModeReason> ] [-PassThru] [ <CommonParameters>]




Detailed Description

The Set-SCOMMaintenanceMode cmdlet updates active maintenance mode entries. You can use this cmdlet to update only active entries.

When a resource is in maintenance mode, System Center 2012 – Operations Manager suppresses alerts, notifications, rules, monitors, automatic responses, state changes, and new alerts.

You can change the comment or reason for the maintenance mode. Use the Get-SCOMMaintenanceMode cmdlet to get a maintenance mode entry to update. Specify an end for the maintenance window.

Parameters

-Comment<String>

Specifies a comment for the maintenance mode entry.


Aliases

none

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-EndTime<DateTime>

Specifies when maintenance mode ends as a DateTime object. A resource cannot be in maintenance mode for fewer than five minutes. To obtain a DateTime object, use the Get-Date cmdlet. For more information, type Get-Help Get-Date.


Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-MaintenanceModeEntry<MaintenanceWindow[]>

Specifies an array of MaintenanceWindow objects. To obtain a MaintenanceWindow object, use the Get-SCOMMaintenanceMode cmdlet.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-PassThru

Indicates that the cmdlet creates or modifies an object that a command can use in the pipeline. By default, this cmdlet does not generate any output.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Reason<MaintenanceModeReason>

Specifies a reason for maintenance mode. The acceptable values for this parameter are:

-- PlannedOther
-- UnplannedOther
-- PlannedHardwareMaintenance
-- UnplannedHardwareMaintenance
-- PlannedHardwareInstallation
-- UnplannedHardwareInstallation
-- PlannedOperatingSystemReconfiguration
-- UnplannedOperatingSystemReconfiguration
-- PlannedApplicationMaintenance
-- ApplicationInstallation
-- ApplicationUnresponsive
-- ApplicationUnstable
-- SecurityIssue
-- LossOfNetworkConnectivity


Aliases

none

Required?

false

Position?

4

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

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

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Update active maintenance mode entries for resources in a domain

This example updates all active maintenance mode entries for a specified domain. The first command creates a DateTime object for one day in the future and then stores it in the $NewEndTime variable.

The second command gets all class instances in the Contoso.com domain and uses the pipeline operator (|) to pass the class instance objects to the Get-SCOMMaintenanceMode cmdlet, which gets maintenance mode entry objects. The command uses the pipeline operator to pass these objects to the Set-SCOMMaintenanceMode cmdlet. This cmdlet updates the end time for each object to the DateTime object stored in the $NewEndTime variable. The command also includes a comment for each updated maintenance mode entry.


PS C:\> $NewEndTime = (Get-Date).addDays(1)
PS C:\> Get-SCOMClassInstance -Name "*.Contoso.com" | Get-SCOMMaintenanceMode | Set-SCOMMaintenanceMode -EndTime $NewEndTime -Comment "Updating end time."

Example 2: Update maintenance mode entry for a specified resource

This example extends maintenance mode for a specified server. The first command gets the class instance named Server01.Contoso.com and then stores it in the $Instance variable.

The second command gets the maintenance mode entry for the class instance stored in the $Instance variable and stores the entry in the $MMEntry variable.

The third command creates a DateTime object for 30 minutes in the future and then stores it in the $NewEndTime variable.

The fourth command updates the maintenance mode session for the maintenance mode entry stored in the $MMEntry variable to the DateTime object stored in the $NewEndTime variable and adds a comment.


PS C:\> $Instance = Get-SCOMClassInstance -Name "Server01.Contoso.com"
PS C:\> $MMEntry = Get-SCOMMaintenanceMode -Instance $Instance
PS C:\> $NewEndTime = (Get-Date).addMinutes(30)
PS C:\> Set-SCOMMaintenanceMode -MaintenanceModeEntry $MMEntry -EndTime $NewEndTime -Comment "Adding 30 minutes to the end time." 

Related topics

 
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.