”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.
Tool:
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/
Scripts:
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)
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)
Hi Michael,
Thank you for above scripts!
Found one mistake. “-Reason” parameters isn’t specified correctly. Should be one of below:
——————————
-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
—————————-
Best regards,
Vikentiy
Hi Vikentij
Thanks for visiting and commenting.
You are so very right about the reasons – thanks!
Regards
Michael
Hello,
I am using SCOM 2007 r2 in my environment. I am performing a daily task by placing the 20 services in maintenence mode in difference timings each. These services are created in windows service template monitor.
Please help me how to automate by using powershell script.
Thanks,
Krish
Hi Krishna
Thanks for commenting my blog.
It wouldn’t be a problem to create the script (besides time) – but – do you have System Center Orchestrator implemented? This might be a good alternative to this.
Unless I can invoice you for the script I will have to do it when I have time.
Thanks
Michael
You should also put the health service and health service watcher of that server, otherwise, an alert will be triggered if the server is rebooted
[…] a PowerShell script (created after reading about something similar on the Coretech Blog, here) that takes machine names passed in as the first parameter, places all machine names in an array, […]
Hi Michael,
I am trying to know the environment of other client in the company, can you help me with the detailed questions to ask to get to know their environment
Hi,
From a command window I call a powershell file from a batch file that can place a server into maintenance mode. It works just fine but sometimes the server may already be in maintenance mode and I can see with the dos window “The class instance is already in maintenance mode.” Is there a way within the powershell script to capture the message “The class instance is already in maintenance mode.” and write to a log file?
Thanks
Hi ,
I would like to use start time as i need them to put in scheduling at my own choice. any way where i can do this?