Search Tools Links Login

Start SCOM Maint Mode with PowerShell


Turns on Maintenance Mode for a specific computer monitored by SCOM (System Center Operations Manager).  Ensure that the OperationsManager module is available on the computer from which this script is executed.

Example script puts machine into maintenance mode for 15 minutes (adjustable by changing the $time variable).  At the time specified, the machine will come out of maintenance mode automatically.

Import-Module OperationsManager
$computer = "mycomputer.mydomain.com"
$time = (Get-date).AddMinutes(15)
$instance = Get-SCOMClassInstance -Name $computer -ComputerName myscommgmtserver
Start-SCOMMaintenanceMode -Instance $instance -EndTime $time -Comment "Applying updates" -Reason PlannedOther

About this post

Posted: 2017-12-13
By: AustinGreca
Viewed: 562 times

Categories

Scripting

System Center

Powershell

Windows

PowerShell Code Cache

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.