다음을 통해 공유


SCCM Patching and OpsMgr Maintenance Mode

Customers using OpsMgr for monitoring and SCCM for patching commonly select the option in SCCM to put MOM/OpsMgr agents in maintenance mode during patching – or even with standard software distribution.

image

This option works great if running MOM 2005 but does not operate as you might think with OpsMgr 2007.  When you set this option and SCCM attempts ‘maintenance mode’ on an OpsMgr agent the result is that the health service is paused.  While the health service is paused you may get heartbeat failure errors and when the health service is resumed, all queued up actions will process at that time resulting in potential alerts.  For this reason and others, I don’t recommend using this SCCM option for OpsMgr agents.

OK, if this isn’t an option then how should we go about putting the OpsMgr agent in maintenance mode during patching?  The approach I describe here assumes you have the OpsMgr agent on every SCCM client and are using maintenance windows in SCCM to dictate when patching is allowed to take place on SCCM agents.  With maintenance windows defined we can use that information in OpsMgr and build groups of agents and then use any number of utilities available to schedule these groups to enter maintenance mode at the appropriate time.  Lets see how this can be configured.

First, we need to get a list of configured maintenance windows in place on SCCM.  To do this, just run the query below on your SCCM database.

select * from v_servicewindow

In my lab I get the following result.

image

The two maintenance windows shown are the two that I have configured for patching specifically.  OK, so how do I find all of the SCCM clients/OpsMgr agents that have this maintenance window?  For that all we have to do is query WMI on each SCCM client/OpsMgr agent as shown.

image

If you look at the results you see that this client has one of my two patching maintenance windows defined – all you have to do is match up the GUID’s returned from WMI with the GUIDs returned from SQL – and in SQL you can see the friendly name associated with each GUID so we know which maintenance window we are dealing with.

Now that we have this information it is very easy to pull this into OpsMgr – just add an attribute to a class – such as the Windows Computer class – to query WMI and pull the maintenance windows GUID from WMI of the client and then build groups for systems with each GUID.  Once you have the groups you can use any number of tools to schedule OpsMgr maintenance mode to correspond with the SCCM maintenance windows!

Comments