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: http://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


Comments (17)

  1. Mark Manty says:

    Sure file content's should look like this:

    1/21/2013 18:59:00

    ON

    30

    Installing hotfixes test

    server1

    server2

    server3

  2. Anonymous says:

    try ISO, this should always work if the programming was good: 2013-04-30

  3. rene says:

    Hey,

    can you please drop a small expample how do you did set up this MM File (cause the cmd says, failed to parse date time).

    Thanks!

  4. alex says:

    Hello Mark,

    same Problem. I get the error 'failed to parse date time'.

    English server with German (Austria) Region/Language format settings.

    If I try to us the german format (30.04.2013) 'Not time to process this file, continue to next.'

    Best Regards,

    Alex

  5. john nguyen says:

    hi there, do you have anything that will work with the groups that have already been defined in scom itself rather than listing the servers in the text file?

    thanks!

  6. Geoff says:

    Hi Mark,

    I too am unable to run to the tool as getting the date parse errors (UK region on UTC time setting).  Any fix/workaround for this as this tool would be really helpful if I could run it.

    cheers

  7. vikentij says:

    Hi! Thank you for this application. Works fine for me! TXT file content that I am using:

    28/11/2013 11:25:00

    ON

    15

    Testing new Maintenance mode feature

    server1

    server2

    But this tool works ONLY for Windows machines?

    How about Unix/Linux?

    Best regards,

    Vikentij

  8. vikentij says:

    Hi,

    When I place Unix/Linux machine into TXT input file, I receive an answer:

    "Unixserver1. NOT Found and not setting maintenance mode"

    This will be great if you can resolve this issue, cause the tool is very usable.

    Best regards,

    Vikentij

  9. vikentij says:

    Hello Mark,

    Have you any resolution regarding issue with Unix/Linux machines?

    Best regards,

    Vikentij

  10. vikentij says:

    Hello Mark,

    Still no updates?

    It looks like you should just add to your script some rows to check if this machine is from class Unix/Linux.Computer or Windows.Computer. Like:

    if Unix/Linux.Computer class than.....

    else go to Windows.Computer class ....

    Best regards,

    Vikentij

  11. Raj says:

    this toll works like charm for single MS.

    We are having four MS so how can we search the servers,Is there any option to mentioen all the MSs.

  12. vikentij says:

    Hi Mark,

    Not needed anymore. I have created PS script for SCOM Maintenance mode, which accepts Windows&Unix machines.

    Best regards,

    Vikentij

  13. Dave says:

    Hi everyone:

    I ran this and it did not do anything, please help. Thanks ... Dave

    C:Usersitdkt>C:MaintenanceModeListSched.exe tsg050 c: TSG022.mm
    Processing file: c:TSG022.mm
    TSG022.mm
    Not time to process this file, continue to next.

    TSG022.mm
    11/12/2014 16:00:00
    ON
    60
    Maintenance of servers we are updating
    TSG022

  14. Dhirendra says:

    Hi Mark,
    I am getting error says "Eerror setting in Maintenance mode. Access to the path 'c:example' is denied

  15. lee says:

    If you put a time that is in the future you get the message "Not time to process this file, continue to next." - therefore you can no schedule the maintenance mode on servers unless you run the script every minute, unless that's what your suppose to do?

  16. Todd says:

    Hi Lee, at the end of the blog:

    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.

    I too was a little confused, as I thought we could forecast maintenance mode in scom.

  17. Steven says:

    it is not working withe error Incorrect number of arguements requires at least 3.

    example: MaintenanceModeListSched d:ScheduledMaintenanceMode*.txt

Skip to main content