Waclaw Chrabaszcz
... there is no spoon ...

SCOM 2012 R2 – How to put servers into Maintenece mode using PowerShell

Friday, March 14, 2014 8:47 PM

In more or less ITIL's world you have to monitor availability and performance of your servers. However from time to time you need to apply approved changes, what means temporary unavailability or performance degradation. When we talk about Worldwide organizations, in many cases it is really hard to inform everyone about upcoming changes. Sometimes you don't want to inform anyone, you just don't want to wake up your colleagues at 2:00 AM their local time. So to apply the change in elegant way let's put affected boxes into maintenance mode, SCOM won't bother anyone with fake alarms. To not spend all day on SCOM console, let's use PowerShell for this task.

Import-Module -name OperationsManager
$servers = (`

$Time = ((Get-Date).AddMinutes(30))
$comment = "Change-997: Applying MS hotfixes"
$reason = "ApplicationInstallation"
<# -Reason Valid values are: PlannedOther,
UnplannedOther, PlannedHardwareMaintenance, UnplannedHardwareMaintenance, PlannedHardwareInstallation,
UnplannedHardwareInstallation, PlannedOperatingSystemReconfiguration, UnplannedOperatingSystemReconfiguration,
PlannedApplicationMaintenance, ApplicationInstallation, ApplicationUnresponsive, ApplicationUnstable,
SecurityIssue, LossOfNetworkConnectivity.
foreach ($server in $servers)
$Instance = Get-SCOMClassInstance -Name $server.ToUpper()
Write-Host $Instance
Start-SCOMMaintenanceMode -Instance $Instance -EndTime $Time -Reason $reason -Comment $comment

If you'll have problem with comma formatting try this way:

$servers = ('dc.TESTDOMAIN.net','SQL-1.testdomain.NET')


No comments posted yet.

Post a comment