SCOM maintenance mode setting for list of servers
Hi,
Mark Manty Premier Field Engineer with Microsoft here with another example for System Center Operations Manager.
Today we are going to walk through an example command line tool that will set maintenance mode for a list of servers in a text file.
Customers who have large environments with SCOM agents will at some point in time need to set maintenance mode for a large number of servers. This example tool will read a list of servers and set maintenance mode on them for the number of minutes specified. It can also stop maintenance mode for a list of servers. It validates that the servers in the tex file are not management servers to prevent setting maintenance mode on your SCOM infrastructure.
I ran this in a test environment and it does not have to run on a RMS or MS to work. It must meet the below requirements in order to run successfully:
- .NET 3.5 Framework
- SCOM R2 Console (User Interface installed)
- Run as account that has administrative rights to the SCOM Management Group
Extract the files to some directory of your choice.
Open Administrative command prompt and edit a text file with the systems you want to put in maintenance mode.
Run the maintenancemodelist.exe with no parameters to see what the command line tool expects for parameters.
NOTE: I added an additional parameter that you can use to add your specific comments for the reason you are setting maintenance mode. See Maintmodelisttoolv2 download.
Now run command passing in your RMS name, path to server list, ON, number minutes for maintenance mode, and optionally the name of the results file to save results to.
Example:
MaintenanceModeList.exe SCOMRMS c:\Maintmode\serverlist.txt ON 120
Results are saved to results.txt file as a default if you do not provide the output file.
See that the servers I listed in my input file are now in maintenance mode and that they were set to 120 minutes.
Note that the tool will not set maintenance mode on SCOM Management servers. This can be useful to use and prevent users from setting maintenance mode on your SCOM servers causing you headaches to recover from.
Now we can run the tool with below command line to stop maintenance mode on the list of servers we previously set.
MaintenanceModeList.exe scomrms c:\maintmode\serverlist.txt Off
Notice that maintenance mode was turned off for all servers in your input file.
This is an example tool that will will speed up the process of setting maintenance mode for a list of servers.
Disclaimer:
This example is provided “AS IS” with no warranty expressed or implied. Run at your own risk. The opinions and views expressed in this blog are those of the author and do not necessarily state or reflect those of Microsoft.
Comments
Anonymous
January 01, 2003
Does this also work in System Center Essentials 2010? SCE2010 has a tool builtin called ScheduleMaintenanceMode.exe but that doesn't really work.Anonymous
January 01, 2003
Amit, Added the additional parameter for adding your specific comment on reason scheduled. Enjoy, MarkAnonymous
January 01, 2003
Hi,
Will this work for SCOM 2012 SP1. also is there a provision by which this tool can be run remotely on the management server as we havent given the permission to alerts team on our RMS.Anonymous
January 01, 2003
Hi Mark, It's great tool...I have tried this tool in my test lab and it worked perfect for me.Also I have use this tool with windows scheduler for scheduling the maintenance mode. I have one query,is it possible to change the default comment in this tool.I want to add incident(ticket) or task number as comment. Thanks in advance. AmitAnonymous
January 01, 2003
Thanks Mark for adding the feature...Anonymous
January 01, 2003
This tool will go handy in my TOOLBOX. I use SCOM & HP SIM , which I have to disable both in order not to trigger an ALERT. I just hate the notion of logging into the client or web page for these apps (SCOM & HP SIM ). I have to use excel lot at work. So I made a spreadsheet to suspend servers in SIM. I would like to use this in my spreadsheet to put servers in maintenance mode. here is what I have done so far for HP SIM http://mr-itpro.serverpit.com/ .... I will do the same for SCOMAnonymous
October 19, 2012
The comment has been removedAnonymous
February 21, 2014
This fails for me with 'Eerror setting in maintenance mode. No such host is known'. Anyone else come across this issue?Anonymous
March 03, 2014
Hi Mark,excellent tool!
Would this have an impact on the RMS if we have a thousand servers to set in maintenance mode?Anonymous
March 07, 2014
Hi is there a way to put cluster resources being monitored in maintenance? When i run this, we are getting errors that says cannot find servers. Thanks.Anonymous
May 07, 2014
Hi Mark, some of my monitored servers are not domain member. I use it to stop the maintenance mode. If there is no FQDN in the input-file (for example srv1 instead of srv1.domain.local) the message is "srv1. NOT Found and not stopping maintenance mode"
Any advice to fix it? Or could you please share the sourcecode?Anonymous
June 24, 2014
Hi Experts,
I am very much new to SCOM tools and exploring something about SCOM. I am looking for the server should not in monitoring state from specific time. like 1 AM to 2AM, is it possible to achieve with this Tools.
Environment is - SCOM 2012 R2Anonymous
July 18, 2014
Are you looking for a way to put objects other than computer ...Anonymous
January 12, 2015
Hi,
very nice program. Is it possible to give a admin user as parameter while running the exe? I don't want to give everynody admin rights only to set the server in MM.
Thanks and regards
DoreenAnonymous
April 08, 2015
Mark - this is a great tool but I did notice something. When using it with Windows clusters the virtual endpoints (Windows, SQL, etc.) come up "host not found". I presume you're searching the Computer class(es) - any chance you could add the Cluster classes as well?Anonymous
June 27, 2015
Thanks a bundle for this!! Friday night 20 mins before the end of shift I am asked to place 30 servers in maintenance mode. Needless to say the tool saved my evening, and saved the world from the cursing I was about to give outAnonymous
December 22, 2015
Hi - this is a great utility! We are just implementing SCOM and it will help out tremendously. However, I have the same issue that a few others have posted about - specifically, the cluster resources not going into MM - I then get a bunch of bogus alerts indicating that cluster resources are offline (when they're not). Is there any work-around for this, other that setting them into MM manually?Anonymous
January 28, 2016
Hi Mark,
I have a group of users who are not part of SCOM admin group, but need to run this tool. The users are part of advanced operators role. Is there some way I can have them run this utility?