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:
Hi,
The above script doesn’t work. It gives exiting as soon as I run it.
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
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
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
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 ?
I’ve to look into the slowness issue. I put in on my list and will let you know!
Regards,
Arjan
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?
The script is now available to download any more. Is it possible to have a copy of it please?
Thanks,
*not
Hi,
Thanks for your message; the script is now posted to my GitHub Account:
https://github.com/arjanvroege/OpsMgr_Scripts/blob/master/SCOM_MM/SCOM2012_MM_0_2.ps1
Regards, Arjan
Hi the Onedrive link to download the script doesn’t work anymore. Can you point me to where I can find the script?
Hi,
Thanks for your message; the script is now posted to my GitHub Account:
https://github.com/arjanvroege/OpsMgr_Scripts/blob/master/SCOM_MM/SCOM2012_MM_0_2.ps1
Regards, Arjan
Thanks, got it.