Welcome to MSDN Blogs Sign in | Join | Help

So what is in maintenance mode?

In MOM 2005 you could put computers into maintenance mode; in OpsMgr 2007 maintenance mode is much more granular. Instead of putting the whole computer into maintenance mode, you can put a particular database or NT service into maintenance mode. At times it can be challenging to figure out what do you actually have in maintenance mode, when did the maintenance mode start and when will it finish, and finally why a particular component is in maintenance mode. Here is a script that I put together that should simplify understanding what is actually in maintenance mode.

$criteria = new-object Microsoft.EnterpriseManagement.Monitoring.MonitoringObjectGenericCriteria("InMaintenanceMode=1")

$objectsInMM = (Get-ManagementGroupConnection).ManagementGroup.GetPartialMonitoringObjects($criteria)

$objectsInMM | select-object DisplayName, @{name="Object Type";expression={foreach-object {$_.GetLeastDerivedNonAbstractMonitoringClass().DisplayName}}},@{name="Start Time";expression={foreach-object {$_.GetMaintenanceWindow().StartTime.ToLocalTime()}}},@{name="End Time";expression={foreach-object {$_.GetMaintenanceWindow().ScheduledEndTime.ToLocalTime()}}},@{name="Path";expression={foreach-object {$_.Path}}},@{name="User";expression={foreach-object {$_.GetMaintenanceWindow().User}}},@{name="Reason";expression={foreach-object {$_.GetMaintenanceWindow().Reason}}},@{name="Comment";expression={foreach-object {$_.GetMaintenanceWindow().Comment}}}

Basically this script does the following:

1 - Creates a criteria object to specify that we want only the objects that are in maintenance mode

2 - Issues a query to the SDK service with the specified criteria

3 - The rest is formatting the data into a table

 Script Output

Published Monday, August 06, 2007 5:23 AM by Boris Yanushpolsky
Filed under:

Attachment(s): ScriptOutput.jpg

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# goteamshake.com » Blog Archives » View all Ops Mgr 2007 objects in Maintenance from Powershell

# Things to know about Maintenance Mode in System Center Operations Manager 2007

Friday, February 29, 2008 9:44 PM by SCOM/MOM

There are many articles that talk about maintenance mode in System Center Operations Manager 2007. Topics

# re: So what is in maintenance mode?

Saturday, April 05, 2008 9:19 PM by Richard K.

small correction for script above.

To get the Comment to show, change this:

$_.GetMaintenanceWindow().Comment

to this:

$_.GetMaintenanceWindow().Comments

# A Great place for SCOM scripts

Sunday, July 13, 2008 7:10 AM by Dario IT Solutions Blog

Check out Boris Yanushpolsky's blog ( http://blogs.msdn.com/boris_yanushpolsky ). Boris is an SCOM

# re: So what is in maintenance mode?

Wednesday, December 03, 2008 6:58 AM by Mark Verbaas

Great post. Is it possible to schedule this (and export to html)? I can't get it to work, just running the ps1 doesn't work, though the execution policy is set correctly.

# re: So what is in maintenance mode?

Tuesday, January 06, 2009 10:19 AM by umair siddiqui

umair_muqeem@hotmail.com

92-300-3056678

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker