Start-SCOMMaintenanceMode
Puts an object into maintenance mode and creates an active maintenance mode entry.
Syntax
Start-SCOMMaintenanceMode
[-Instance] <MonitoringObject[]>
[-EndTime] <DateTime>
[[-Comment] <String>]
[[-Reason] <MaintenanceModeReason>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Start-SCOMMaintenanceMode cmdlet puts a monitored object, such as a computer or distributed application, into maintenance mode and creates an active maintenance mode entry. When a resource is in maintenance mode, System Center 2016 - Operations Manager suppresses alerts, notifications, rules, monitors, automatic responses, state changes, and new alerts.
Specify a class instance to put into maintenance mode and an end time for the maintenance window. You can also include a comment and a reason for the maintenance mode. You can use the Set-SCOMMainenanceMode cmdlet to update an active maintenance mode entry and use the Get-SCOMMainenanceMode cmdlet to get both active and inactive entries.
Examples
Example 1: Put a resource into maintenance mode
PS C:\>$Instance = Get-SCOMClassInstance -Name "Server01.Contoso.com"
PS C:\> $Time = ((Get-Date).AddMinutes(10))
PS C:\> Start-SCOMMaintenanceMode -Instance $Instance -EndTime $Time -Comment "Applying software update." -Reason "SecurityIssue"
This example puts a resource into maintenance mode for ten minutes. The first command gets the class instance named Server01.Contoso.com by using the Get-SCOMClassInstance cmdlet.
The second command creates a DateTime object for ten minutes in the future and then stores it in the $Time variable.
The third command puts the resource defined by the object stored in the $Instance variable into maintenance mode. Maintenance mode ends at the time stored in the $Time variable. The command includes a reason for maintenance mode and a comment.
Parameters
-Comment
Specifies a comment for the maintenance mode entry.
Type: | String |
Position: | 3 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
Prompts you 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 |
-EndTime
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
.
Type: | DateTime |
Position: | 2 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Instance
Specifies an array of monitoring objects that represent instances. To obtain monitoring objects, use the Get-SCOMClassInstance cmdlet.
This parameter also accepts group objects. To obtain a group object, use the Get-SCOMGroup cmdlet.
Type: | MonitoringObject[] |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
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.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Reason
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
Type: | MaintenanceModeReason |
Position: | 4 |
Default value: | None |
Required: | False |
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 |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |