Enabling Maintenance Mode for a group of servers late on a Friday afternoon of urgently because the admins forgot to let the SCOM admins know has always been a little bit of a problem. In step the SCOM SDK, Exchange EWS 2.0 and some very awesome Vb.net coding skills.
The challenge of doing something like this is the control ie: who are allowed to send emails to request maintenance mode, what if the group does not exist in SCOM etc etc.
The utility makes use of an encrypted file to store email addresses (white-list) and also the groups that each email address are allow to put into maintenance mode.
The configuration file also contains the following
1. Email address for the mailbox to receive the emails for maintenance mode
2. User Account and password (encrypted) to access the mailbox
3. SCOM management server, user id and password to connect to the SCOM server
All the information in the configuration file is encrypted and unreadable.
The admin will send an email to the maibox in the following format for starting of maintenance mode
StartTime: (Startime of maintenance mode)
Duration: (Duration in minutes)
Comment: (Comments to include in the maintenance mode details)
Action: (Start for starting of maintenance mode)
Other values for the Action includes: Stop, Extend and Query
Email that will be received on a “Query” action looks like below
Group is already in maintenance mode, see details below, maybe use ‘Action: Extend’ to extend the current maintenance mode
Group: <Group Name> Current Maintenance mode details
||Scheduled End Time
|Maintenance Mode requested by : Admin.EV on 12/1/2016 10:32:40 AM Comment provided: Testing the utility
||12/1/2016 10:31:00 AM
||12/1/2016 11:01:00 AM
Confirmation emails are also sent confirming maintenance mode stopped, started and extended.
Example of the confirmation email below:
The Maintenance mode info for the SCOM objects are also updated with the details, when right clicking on any object in the particular group in the SCOM console and viewing the maintenance mode details, a screen similar to below appear.
The utility itself will be executed as a scheduled task on a server. The Interval can be set to any value. The utility will process all the emails with a subject of “SCOM Maintenance Mode” and action maintenance per group in the email according to the action etc.
Currently it’s one email for one group, no multiple groups per single email will work.
If any of the values required is not contained in the message body an “invalid request” email will be sent back with clear instructions on what is required.
Please leave a comment here if you are interested in receiving a copy of this utility.