QuickTricks: One line PowerShell to remove all objects from maintenance mode

Are you looking for quick ways to see what is in maintenance mode and get them back out of maintenance mode? This blog post goes through the following:

  • What is currently in maintenance mode?
  • Removing all objects from maintenance mode

     

What is currently in maintenance mode?

To see what is currently in maintenance mode the following two approaches are available. The first option is not as usable from an output perspective but works well when removing items from maintenance mode. The second shown below provides a more readable format.

Get-SCOMMaintenanceMode


Get-SCOMMonitoringObject | where-object {$_.InMaintenanceMode -eq $true}

 

Removing all objects from maintenance mode

The following single line PowerShell script will take any objects currently in maintenance mode and remove them from maintenance mode:

Get-SCOMMaintenanceMode | Set-SCOMMaintenanceMode –EndTime (Get-Date) –Comment “Autoremoved from maintenance mode”

The graphic below shows how the PowerShell script runs when removing all items from maintenance mode and the results of re-checking what is in maintenance mode using the Get-SCOMMaintenanceMode command (no results indicating that there are no longer any objects which are in maintenance mode in this management group).


 

2 thoughts on “QuickTricks: One line PowerShell to remove all objects from maintenance mode

  1. Pingback: SCOM link - IT Consult

  2. Pingback: link scom 2012 troubleshooting, how-to, management pack, patch, cmdlet, planning, deployment, installation | IT Consult

Leave a Reply