SCOM 2012: Powershell Maintenance Mode Script

Standard

Putting hosts in Maintenance mode through the SCOM console is not the fasted way when you have more than 1 host on which you want to activate Maintenance Mode and when the host is also part of a cluster it’s not enough to only add a maintenance window for that host. You will still receive cluster alerts from the cluster on where the host resides. So today I created the first version of  my own Maintenance Mode script. The script has the following functionality:

  • Put a host or Group in Maintenance Mode
  • Checks if the host is part of a cluster, if yes the script will also put the Cluster in Maintenance Mode including all Cluster Resources.

CAUTION: If you don’t want to put the corresponding cluster in Maintenance Mode you have to edit this script!

NOTE: This is the first version of the script. The following still needs to be done:

  • Better checking functionality (Error and Already MM activated)
  • Stopping Management Mode function

The script can be downloaded here.

 Before using the script you have to change this line:

$MgntSrv   = "Your SCOM Management Server"

 Replace ‘Your SCOM Management Server’ with one of your own Management Servers!

This script is based on the following posts:

13 thoughts on “SCOM 2012: Powershell Maintenance Mode Script

    • Arjan Vroege

      Could you please give me for information about when the script failed and what error you receive?
      I would like to help you to make this script work for you.

      Regards, Arjan

  1. The above script doesn’t work for me either.

    the -Name is not part of the Get-SCOMAgent parameter. If I typed -N, -Name does not exist in the selection that pops out.

    Thanks

  2. Arjan Vroege

    Hi Joebert,

    I tested the script on my SCOM environment and the Name parameter is accepted.

    This links says that the Name parameter isn’t accepted anymore. You can change the Name parameter with DNSHostName (http://technet.microsoft.com/en-us/library/hh920187(v=sc.20).aspx). This should also work.

    Please let me know if this works out for you. If so I will update the script.

    Regards, Arjan

    • Madhavi

      Hi ,
      Thanks for sharing the script , it works perfectly fine. Only issue we see is slowness , as we are placing more than 50 servers in MM at the same time. It takes quite a lot of time to place server and cluster in MM.

      Can the script be modified to improve the speed ?

      • Arjan Vroege

        I’ve to look into the slowness issue. I put in on my list and will let you know!

        Regards,

        Arjan

  3. Marius

    This script can be started only by SCOM Admin, because of Get-SCOMAgent. How could I modify this script to allow starting MM for Operator Role?

  4. Richard Pearson

    The script is now available to download any more. Is it possible to have a copy of it please?

    Thanks,

Leave a Reply

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