i work on a way to get automatic maintenance mode in scom for my servers when they install some patches.
I created a powershell Monitor checking for some Events wich initiates a Server Reboot based on updates. When the Event detection is true my Monitor changes the state in critical. Then i tryed to start a recovery Task for starting the maintenance mode. The Problem is that die Task should run on the mgt. Server and not on the Agent because most of my Server do not have the required powershell modules for scom.
Does anybody has a workarround for this Problem. Is there a way to run a Task on the Mgt. Server initiated by the Monitor?
Another option would be to look to integrate more closely with your patching mechanism. For example you could store patching information in the registry of each server and use that to populate groups (or you could directly populate patching groups in SCOM from another system). This is our approach.
You then schedule maintenance mode on the groups using task scheduler \ Orchestrator \ a.n.other automation solution. We automate the creation of scheduled tasks for the group each month so that maintenance mode is always initiated on the correct day \ week for each group of servers.
For your approach, how do you know if the rule (or monitor) is being triggered by patching or just by a reboot? E.g. are you looking for a 6005 --> 6009 event? You could do this as a rule which generates and alert (informational) which includes the server name as a parameter. The alert ten triggers a notification (script) that runs a maintenance mode script which accepts the server name as a parameter. The challenge with this approach is that you will likely hit the asyncprocess limit - http://jimmoldenhauer.blogspot.co.uk/2013/01/scom-2012-maximum-number-of.html
We have multiple solutions in place. API, of course, but prior to that we also used a rule that listened to scheduled reboot from wsus. It maintenance the agent through a command channel and a subscription. https://adatum.no/operationsmanager/maintenance-mode-based-on-event