SCOM Remote Maintenance Mode Scheduler 2.0 R2 Scripts

For SCOM 2012 please see my maintenance mode scheduling tool.  https://www.scom2k7.com/scom-2012-maintenance-mode-scheduler/

 

I have updated the scripts for SCOM Remote Maintenance Mode Scheduler 2.0 to properly support SCOM R2.

Download: MaintenanceModeV4_R2.zip

The old scripts worked ok but if you had a large group of servers it would take a long time with R2. The old scripts would try to put the HealthService and the HealthServiceWatcher in maintenance mode which is no longer necessary with R2.

Another thing I added to the scripts was to not re-set the maintenance mode of a server if it is already in maintenance mode.  I have seen instances where a particular server is put into maintenance mode for a long period of time and then a scheduled maintenance mode job will re-set the maintenance mode causing noise and skewed reports.

To install the scripts just rename the old scripts and then copy the new scripts into the same “C:\MaintenanceModeV4” directory.

**You will also might need to Remove the Security from the Downloaded PowerShell Scripts

foo

Please let me know if you come across any issues.

27 Responses to SCOM Remote Maintenance Mode Scheduler 2.0 R2 Scripts

  1. Aengus April 28, 2010 at 7:33 pm #

    Awesome, thanks Tim!
    Any plans to include network/snmp devices in the utility?
    Cheers,
    Aengus

  2. Doug April 30, 2010 at 11:17 am #

    If I create a group and the group name has a space in it and place member computers in it, this script will not put that group into maintenance mode. If I run powershell interactively it says “MYGROUPNAME not found”

  3. Layne April 30, 2010 at 4:58 pm #

    This has always been a great tool. If I could figure out a way to have it check if the computer is a cluster node, and if so put the entire cluster and all its objects into Maintenance Mode, this would be the ultimate tool. I’ve been using a different script from Kris Bash to do that. While I can’t believe something like this isn’t in the product, I’m thrilled the community can provide such assistance. Thanks Tim!

  4. Dean May 2, 2010 at 5:36 pm #

    Fantastic, Cheers Tim.
    Works perfect in my R2 environment however, the script does not cater for group names containing a space as Doug has correctly pointed out. Brilliant, nontheless..

  5. Dean May 2, 2010 at 6:14 pm #

    My lack of patience strikes again!! The script does indeed cater for groups containing spaces and it interacts beautifully with the the Availability Reports i.e. it highlights the period of planned downtime.

    Absolute Genius Tool Tim thanks….

  6. Chris June 3, 2010 at 11:51 am #

    After launching the Scheduler and clicking create I keep getting this error: “The network path was not found. (Exception from HRESULT:0x80070035” What am i missing here?

    • Tim June 28, 2010 at 5:06 pm #

      You might be having a firewall issue. To to ping the box you are trying to create the task on.

  7. Birli June 25, 2010 at 1:40 am #

    Hi guys,
    I get an access denied message when I try to schedule the maintenance. Any comments on this?

    • Tim June 28, 2010 at 5:03 pm #

      You are having a permission problem. Make sure you are a member of the SCOM admins and that you have admin access to the box that is going to be running the tasks.

  8. Keithk July 8, 2010 at 4:42 pm #

    I would really like to run this script at the opsmgr command shell, however when I try to run the script and entering parameters, it doesn’t seem to work. Should I just be able to run this at the OpsMgr command shell? Any suggestions how I can do this?

  9. Ernie August 7, 2010 at 5:31 pm #

    Hello,

    I want to allow operator or advanced operators to be able to put computers into maintance mode without the need to them to be members of the SCOM Administrators group. How do I do this by running the script with a Run As Account and Run As profile?
    Please advise, Thanks

  10. Frankg October 23, 2010 at 1:04 pm #

    Hi,

    Thanks for keeping this tool so great !

    Is there a way to put UNIX/Linux serveur in maintenance with your tool ?

  11. Mats Augustsson November 15, 2010 at 4:09 pm #

    Hi!

    I have just start to use your nice script to scheduler SCOM agent into maintenance mode. Just one problem I don’t get the AM/PM when I choose a Start Date and Time

    Maybe it can be that we use 24 hours clock.

    How can I solve this?

  12. Brian Small December 10, 2010 at 12:31 pm #

    Hello,
    I am running SCOM scheduler 2.0 R2 and have added the new scripts as instructed. However, I get the following error when running the GUI: “Object reference not set to an instance of the object”. Not sure what this means. Please advise.

    • Tim McFadden December 10, 2010 at 1:56 pm #

      Check your firewall or permisions

  13. user February 7, 2011 at 8:20 am #

    The script has problems with dynamic filled groups,
    for my citrix group the script returns 0 computers,
    if I change this line:
    $computers = $groupInstance.GetRelatedMonitoringObjects($windowsComputerClass,[Microsoft.EnterpriseManagement.Common.TraversalDepth]::OneLevel)

    to

    $computers = $groupInstance.GetRelatedMonitoringObjects()

    it returns 22 computers.

  14. Keithk February 8, 2011 at 5:11 pm #

    When I tried putting a group after browsing the list of group I got the error:
    “Object reference not set to an instance of an object.”

    I found that in the comments section I was using a date that contained “/” (minus the quotes)which caused the problem. When I changed the date from “/” to use “-” it worked fine. For example a comment using 2/4/2011 would not work, but a comment using 2-4-2011 would work.

  15. Random Decoy March 21, 2011 at 1:04 pm #

    I was getting same error as Keithk from my RMS (SCOM 2007 R2 on Windows 2003 Standard x64 w/SP2), “Object reference not set to an instance of the object”. I followed his lead by removing punctuation from the comment. Then, I retried creating the task. Without the punctuation I was able to create the task successfully. Thanks for the tool!

  16. Stephen Weber May 16, 2011 at 11:13 am #

    Tim, this looks like a superb package for something which looks to take an inordinate amount of scripting, for all the other workarounds I’ve seen on the net. I’ve installed and configured it (I’m in 2007 R2) per all your instructions, and can create a scheduled event – it shows on both the SCOM scheduler list as well as the Task Scheduler – but the problem is, when the task is supposed to activate, it doesn’t. I’ve tried it a number of times, and I’m not sure, but I think I’ve see a quick instance of the shell pop up (with red text) for less than a second at start time. I run it on our SCOM server, which also serves as our RMS server as well.

    Any thoughts you might have would be much appreciated – thanks in advance.

  17. Al Howarth February 16, 2012 at 3:18 pm #

    I cannot get this to work. It creates the task, and Task Scheduler states that it runs, although the servers never go into Maintenance Mode.

  18. David March 9, 2012 at 1:42 pm #

    I am having an issue similar to Stephen Weber. I run the Remote Scheduler as my server administrator account, it successfully creates the task on the management server, the task either does not run, or runs successfully but does not place the target server in maintenance mode. If I copy the actions with arguments to powershell, the server goes into maintenance mode as intended. I did notice that you must have a comment in the “comment:” section or the script will fail. Error message displayed below:

    “New-MaintenanceWindow : Cannot bind argument to parameter ‘Comment’ because it
    is an empty string.
    At C:\MaintenanceModeV4\AgentMaintenanceModeV4.ps1:23 char:75
    + New-MaintenanceWindow -startTime:$startTime -endTime:$endTime -comment:
    <<<< $comment -Reason:$reason -monitoringObject:$computer
    + CategoryInfo : InvalidData: (:) [New-MaintenanceWindow], Parame
    terBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAl
    lowed,Microsoft.EnterpriseManagement.OperationsManager.ClientShell.NewMain
    tenanceWindowCmdlet"

    • Tim McFadden March 9, 2012 at 2:38 pm #

      Check the account you using to schedule the task. Go to the server that has the scheduled task and try to run the scheduled task. Do you get an error code? If so what is it?

  19. Lahru March 16, 2015 at 3:15 pm #

    I’m having difficulty importing the MPs. Specifically SCOM2012.Maintenance.Mode.Scheduler.Dashboard Version 5.0.0.1
    ERROR:
    The following dependent management packs are missing (Also cannot find in Microsoft Catalog):
    Microsoft.SystemCenter.Visualization.Componen.Library Ver. 7.1.10226.1015
    &
    Microsoft.SystemCenter.Visualization.Library Ver. 7.1.10226.1015

    Please Advise

Trackbacks/Pingbacks

  1. KB: Understanding Operations Manager Maintenance Mode - System Center: Operations Manager Engineering Team Blog - Site Home - TechNet Blogs - June 28, 2012

    […] Manager community also has a tool for scheduling Maintenance Mode for monitored objects: https://www.scom2k7.com/scom-remote-maintenance-mode-scheduler-2-0-r2-scripts/ Additionally, you can use Orchestrator to put objects into Maintenance Mode on a schedule, and […]

  2. KB:理解SCOM的维护模式 - SystemCenter 中文社区 - September 3, 2012

    […] https://www.scom2k7.com/scom-remote-maintenance-mode-scheduler-2-0-r2-scripts/ […]

  3. KB: Understanding Operations Manager Maintenance Mode - November 4, 2014

    […] https://www.scom2k7.com/scom-remote-maintenance-mode-scheduler-2-0-r2-scripts/ […]

Leave a Reply