”How can I schedule maintenance mode in SCOM 2012?”

“How can I put a server in maintenance mode without using the Operations Console?”

These are fairly common questions from my costumers. A lot of tools was developed to Operations Manager 2007, but not for 2012, hence this blog.


SCOM Remote Maintenance Mode Scheduler 2.0 by Tim McFadden

I can’t take any credit for this one, as it was developed by Tim McFadden, but it is the best (only) scheduler I can find. Furthermore, it has an UI, which makes it far easier to put servers or group in maintenance mode.

The only cons in my opinion: you have to enter username, password, task server and management server each time you use the tool. Furthermore (is it might just be me) I cannot get it to work without writing something in the comment field.

When putting a server in maintenance mode, a scheduled task is created.

To be downloaded at: http://www.scom2k7.com/scom-remote-maintenance-mode-scheduler-20/


There are a lot of scripts on how to put a group in maintenance mode, find them here.

It is fairly easy making a Powershell script to put a server in maintenance mode. The only problem is that we don’t have a  –StartTime parameter, which means we can’t schedule maintenance mode from Powershell. I have written these scripts to put a single server in maintenance mode right away:

# Ask user for server name (FQDN)

$ServerName = ReadHost What is the name of the server? (FQDN)
$Instance = GetSCOMClassInstance $ServerName
# Ask user for number of minutes
$Minutes = ReadHost For how many minutes?
$Time = ((GetDate).AddMinutes($Minutes))
StartSCOMMaintenanceMode Instance $Instance EndTime $Time Reason “Other(Unplanned)Comment your comment

You simply have to insert a server name and the number of minutes you want the server to be in maintenance mode. You can run this from a Windows Powershell by putting Import-Module –Name OperationsManager in the first line.

If you want to use days instead of minutes, use the below:

# Ask user for server name (FQDN)

$ServerName = Read-Host “What is the name of the server? (FQDN)”
$Instance = Get-SCOMClassInstance $ServerName
# Ask user for number of days
$Days = Read-Host “For how many days?”
$Time = ((Get-Date).AddDays($Days))
Start-SCOMMaintenanceMode -Instance $Instance -EndTime $Time -Reason “Other(Unplanned)”-Comment “your comment”
Happy maintenance mode’ing!