Tip: Scheduling Maint Mode for objects classes other than agents
We published a nice Powershell sample for putting a specific object (regardless of object class) awhile back (check it out HERE). Here’s a good example of how to put an website monitor into maintenance targeting the object display name.
-
Replace “Web Application Name” with the Display Name with that on your monitor.
-
Replace the 60 with the number of minutes you’d like to throw the object into maintenance.
$Now = get-date
$WebAppObject = get-monitoringobject | where {$_.DisplayName –eq “Web Application Name”}new-maintenancewindow -starttime $Now -endtime $Now.addminutes(60)
–comment “Nightly shutdown” –monitoringobject $WebAppObject
Wrap that up with the connection string to connect to your management group and save as a .ps1 file and you can schedule it in a task to run nightly!
Thanks to Graham for posting the additional example on the original post.
Update your MOM skills to Operations Manager 2007 at the Operations Manager 2007 Bootcamp!
Check the 2008 Bootcamp Schedule and request pricing and availability HERE.

May 7th, 2008 at 3:27 pm
[…] See the code snippet for maintenance mode for any object class HERE or HERE. […]