SCOM scheduling maintenance mode tool

Hi,

Mark Manty Premier Field Engineer with Microsoft here with another example for System
Center Operations Manager.

You might recall the previous example command line tool that would set maintenance
mode for a list of servers in a text file. Today I have an updated example that
built upon the existing tool. Previous example: https://blogs.technet.com/b/markmanty/archive/2012/05/14/scom-maintenance-mode-setting-for-list-of-servers.aspx

You may find that you have many requests for scheduling down time for servers and would
rather enable your customers to set their own maintenance mode times without
logging into SCOM servers. With this new example you can provide customers with
access to copy text file to a share with their list of servers and maintenance
mode configuration to allow them to perform this on their own.

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) or SCOM 2012 Console (tested with SCOM 2012 SP1)
  • Run under an account that has administrative rights to the SCOM Management Group

 

Extract the file MaintenanceModeListSched.exe from MaintenanceModeListSchedExample_V1.zip
to a directory of your choice.

Open Administrative command prompt and edit a text file with the systems you want to
put in maintenance mode.

Here I am typing out the text of three example files used to set maintenance mode for. Note the first line is date time in military time. 2nd line is ON or OFF indicating to turn on or off maintenance mode. 3rd line is number of minutes. 4th line is the maintenance mode reason. 5th through last line is the list of servers you want to set maintenance mode on.

Example1.mm is set to run at 4:00 pm or later. Example2.mm is set to run at
6:23 pm. And ExampleFail.mm has a miss-formatted date time field.

 

 

Run the maintenancemodelistsched.exe with no parameters to see what the command line
tool expects for parameters.

Now run command passing in your RMS name, directory where maintenance mode text files will
reside, and wildcard to the file names to process.

Example:

MaintenanceModeList.exe
SCOMRMS c:\Maintmodelistschedule *.txt

 

Note only the servers in example1 file were set, however the Management servers were not placed in maintenance mode by design. 

 

 

See folders and results.txt file contents. Results are appended to this file every time it sets
maintenance mode on servers specified in the files.

Screen shot
below:

 

 

 

 

 

 

If a file is miss formatted it is moved to the Failed folder for your review.

  

 

 

 

 

 

Note that the file that was processed is moved to the Completed folder and renamed to add
date time to ensure unique and allow you to know when this file was processed.

 

 

  

 Event log error is created in the event of a date time parsing error. See event below:

 

 

Event log success informational event is raised for every file it processes successfully.

 

 

Event 100 is logged every time the tool is run. This could be used to monitor for missed
event and alert to notify you when the scheduled task may be failing to execute
the tool.

 

 

 

 

You can create scheduled tasks to run every 5, 10, or 15 minutes to set maintenance mode on
the files in a folder of your choice. Then ensure you share out that folder to
customers that will be using this process to schedule maintenance mode for
their servers. As mentioned earlier you can monitor for events in the event log
to alert you when issues occur.

 

This is an example tool that will enable your customers to schedule maintenance mode on
servers without having to understand how to navigate SCOM and also without
having to provide access to the SCOM console.

 

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.

 

MaintenanceModeListSchedExample_V1.zip