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:
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:
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
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: http://scom2k7.blogspot.com/2007/08/new-maintenance-mode-tool-for.html