Partager via


OpsMgr 2007 - Putting computers in maintenance mode remotely

So you have a simple case where a server operator needs to perform some maintenance and he does not have an OpsMgr console. You can use the tool provided by Clive:

https://blogs.technet.com/cliveeastwood/archive/2007/09/18/agentmm-a-command-line-tool-to-place-opsmgr-agents-into-maintenance-mode.aspx.

However the tool either runs locally on the OpsMgr server or you need to explicitly provide credentials if you want to target it at a specific OpsMgr server.

What I do is run the tool via psexec (PsExec v1.92) in such a batch file:

@Echo off
SET /P agentName=["Please provide agent FQDN that you want to put to maintenance mode and press enter"]
SET /P MMtime=["Please provide how long maintenance mode will be on in minutes and press enter"]

psexec -accepteula \\FQDNofYourOpsMgrServer Drive:\Folder\agentMM.exe %agentName% 4 "Automated Maintenance Mode" Now +%MMtime%m

PAUSE

Just put that in a batch file and distribute it along with psexec.exe to your servers. You need to make sure you have the agentMM.exe tool in Drive:\folder\ on your management server.

The downside is that you need OpsMgr Admin privilege to run it + privilege to launch the process remotely with psexec. If you cannot afford that then you need to use powershell script which allows to enable Maintenance Mode with Operator privilege:

- agent/group scheduled: CmdSchedMaint.zip

- agent/group nonscheduled: https://scom2k7.blogspot.com/2007/08/new-maintenance-mode-tool-for.html

Comments