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


Comments (6)
  1. SCOM/MOM says:

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

  2. Richard K. says:

    small correction for script above.

    To get the Comment to show, change this:


    to this:


  3. Check out Boris Yanushpolsky's blog ( ). Boris is an SCOM

  4. Mark Verbaas says:

    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.

Comments are closed.

Skip to main content