I know scheduled maintenance mode functionality is coming to SCOM 2016 as shown here. However I have clients that are still on SCOM 2012 R2 that need to schedule maintenance mode in SCOM right now. There are options out there for this already the best solution is a tool called SCOM 2012 Maintenance Mode Scheduler . It has a small fee but is well worth it. Sometimes I have clients that would prefer to run a script vs. pay the fee for a tool especially when this is coming to SCOM 2016.
There are a bunch of scripts out there for this but most are old and or don’t work. I have been using my own script to do this for a while. I recently updated it and have decided to share it. I run this script from Windows task scheduler. It could also just as easily be scheduled to run from Orchestrator, SMA or Azure Automation. I will put the download link at the end of this blog post. This script will put a SCOM group in maintenance mode. It also sets the duration in minutes but can easily be changed to hours.
Here is the PowerShell script: