SCOM maintenance mode setting for list of servers
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.
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.
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.