Maintenance Mode by Config File


Derek Harkin did some good work with his management pack that allows agents to be placed in maintenance mode from the agent itself simply by executing a script - no requirement for powershell, .net, etc and the user who executes the script does not need any rights to OpsMgr! The script would generate an event which the management pick reads and responds to by executing a powershell script on the management server that actually does the work of putting the agent in maintenance mode.


I modified Derek's management pack to allow server owners to specify a config file on the agent and simply make additions/changes to the config file to configure when the agent should enter maintenance mode and how long maintenance mode should last.  This config file can either specify a recurring weekly schedule or a one time entry.  Take a look at the readme.txt for more information.

AgentMaintMode.zip

Comments (2)

  1. Robb says:

    Hi Steve,

    I’m trying to use this script/MP of yours, but I’m running R2.  I understand that this script might be dated.  I think the main issue that I have now is that the response action is trying to execute on the agent instead of the management server.  I don’t have powershell installed on all the agents.  Did this behavior change from SP1 to R2?  Any suggestions?

    Thank you!

  2. steverac says:

    The script/MP should work fine on SP1 or R2 – the action isnt being initiated on the agent it is initiated on the RMS.  The only action happening on the agent is the execution of the vb script to check for upcoming maintenance mode.  My guess is that the execution policy for powershell on your RMS is not configured o allow the powershell script to run.  Note also that Derek has an updated version of his MP that incorporates some of the scripting work I did and also takes advantage of the native R2 powershell provider.

Skip to main content