A few opsmgr questions of interest – Question 2


1.       How can an agent be placed in maintenance mode from the command line?  What are the other options for placing an agent or group of agents in maintenance mode? 


 


Agents can be placed in maintenance mode from the command line in one of two ways – using  command shell or using a script written by Clive Eastwood in the opsmgr product team.


 


Command shell


The command shell scripts below are useful for putting an agent into FULL maintenance mode.  The use of these scripts assumes power shell is installed on the local system, which very likely will not be the case.  Please also note that it is not supported to place a RMS into maintenance mode while it is operational as an RMS.  These script examples are taken from the blog post at http://scom2k7.blogspot.com/2007/08/new-maintenancemode-tool-for.html



Individual system


AgentMaintenanceMode.ps1 –rootMS: ‘omrms1.contoso.com’ -computerPrincipalName: ‘ql1tmactest1.mi.corp.rockfin.com’ -numberOfHoursInMaintenanceMode:4 -comment:’ql1tmactest1.mi.corp.rockfin.com MaintenanceMode’


Group


GroupMaintenanceMode.ps1rootMS: ‘omrms1.contoso.com’ -groupName: ‘_AU 3AM Sunday Reboot’ –numberOfHoursInMaintenanceMode:4 -comment:’_AU 3AM Sunday Reboot MaintenanceMode



I mentioned that these scripts will enable FULL maintenance mode for an agent.  Maintenance mode has changed notably in opsmgr.  In MOM 2005 we placed a system in maintenance mode and that was it – only one type of maintenance mode.  In opsmgr we have three different components (the agent, the agents health service and the agents health service watcher)  that must be placed in maintenance mode to fully achieve an ‘offline’ state for the agent.  You could also choose to place just one of the three components in maintenance mode – which would allow all monitoring by the other pieces not in maintenance mode to continue.

In addition to command shell any of the above agent components can be placed in maintenance mode through the UI.  In addition, monitors may be placed in maintenance mode individually.


AgentMM
Clive Eastwood of the opsmgr product team has written a script to place an agent in FULL maintenance mode.  This tool is similar to the MOMInfo or maintmode utilities in MOM 2005.  The tool may be downloaded from Clive’s blog post at
http://blogs.technet.com/cliveeastwood/archive/2007/09/18/agentmm-a-command-line-tool-to-place-opsmgr-agents-into-maintenance-mode.aspx

Comments (0)

Skip to main content