How to check SCOM Maintenance Mode history?

In this article I would like to show you quick and easy way to get detailed information about last SCOM maintenance mode. To gather SCOM MM history we have to use Operations Manager PowerShell cmdlets available here.

After providing server name script will gather the following information:

– Start Time
– End Time
– Scheduled End Time
– User
– Reason
– Management Group
– Comments

        

    $Server = Read-Host -Prompt "Please provide server name"
    $InstanceClass = Get-ScomClass -Name "Microsoft.Windows.Computer"
    $Instance = Get-SCOMClassInstance -Class $InstanceClass | Where-Object {$_.DisplayName -match $Server}         
    $MM = (Get-SCOMMaintenanceMode -Instance $Instance -History -ErrorAction 0)

    # Display information in host
    Write-Host "`nMaintenance Mode history for $Server :" -ForegroundColor Green

    $Object = New-Object PSObject -Property ([ordered]@{ 
   
        Server                  = $Server
        StartTime               = $MM.StartTime
        EndTime                 = $MM.EndTime
        ScheduledEndTime        = $MM.ScheduledEndTime
        User                    = $MM.User
        Reason                  = $MM.Reason
        ManagementGroup         = $MM.ManagementGroup
        Comments                = $MM.Comments
  
    })  
    $Object
    

In our other article you can find how to put servers in SCOM Maintenance Modelink.
Check SCOM Maintenance Mode history on multiple servers – link.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.