SCOM Remote Maintenance Mode Scheduler is a GUI based tool that lets administrators easily schedule maintenance mode for a server or group of servers inside System Center Operations Manager 2012

Download for 2012: SCOMRemoteScheduler2.0_R2.zip

Instructions:  SCOMRemoteMaintenanceModeScheduler2.0.pdf

New Features in version 2.0 include

  • Ability to schedule a daily maintenance mode.
  • New Show Scheduled Tasks Dialog.
  • Added feature to see all details for scheduled jobs.
  • Added feature to delete scheduled jobs
  • Fixed Minor bugs

Here is what the new Show Scheduled Tasks Dialog looks like

 

Categories:

Tags:

136 Responses

  1. It’s getting there, just not as quickly as we want. In our environment, it would be useful to be able to import a .txt, .csv, or .xls file with a list of servers.

  2. I am trying this for the first time. Not sure what this error means “The given path’s format is not supported”

    Great potential, though, to help in a big way….

  3. Hi Tim:

    Thanks for the wonderful tool for the newbie SCOM 2007 admins like me.

    While running the scheduler, I ran into an issue. I tried to run the code directly from the command shell and I get the following error regarding the “null array”. Copy of your script is below the error message.

    Can you tell why I am getting null array?

    Thanks,

    David

    ===============================================================

    C:\>C:\WIN2k3\system32\WindowsPowerShell\v1.0\powershell.exe C:\MaintenanceModeV
    4\AgentMaintenanceModeV4.ps1 -rootMS: `atmspmom04′ -computerPrincipalName: ‘atms
    pasv01’ -minutes:30 -comment: ‘atmspasv01’ -reason: ‘PlannedOther’
    PathName :
    ManagementGroup : SCOM2007DC2
    ManagementServerName : atmspmom04
    Drives :
    You cannot call a method on a null-valued expression.
    At C:\MaintenanceModeV4\AgentMaintenanceModeV4.ps1:13 char:56
    + $healthServices = $computer.GetRelatedMonitoringObjects( <<<< $healthServiceC
    lass)
    Cannot index into a null array.
    At C:\MaintenanceModeV4\AgentMaintenanceModeV4.ps1:14 char:34
    + $healthService = $healthServices[0 <<<< ]
    Putting atmspasv01 into maintenance mode
    New-MaintenanceWindow : Cannot bind argument to parameter ‘MonitoringObject’ be
    cause it is null.
    At C:\MaintenanceModeV4\AgentMaintenanceModeV4.ps1:22 char:81
    + New-MaintenanceWindow -startTime:$startTime -endTime:$endTime -monitoringObje
    ct:$ <<<< computer -comment:$comment -Reason:$reason
    Putting the associated health service into maintenance mode
    New-MaintenanceWindow : Cannot bind argument to parameter ‘MonitoringObject’ be
    cause it is null.
    At C:\MaintenanceModeV4\AgentMaintenanceModeV4.ps1:26 char:81
    + New-MaintenanceWindow -startTime:$startTime -endTime:$endTime -monitoringObje
    ct:$ <<<< healthService -comment:$comment -Reason:$reason
    Putting the associated health service watcher into maintenance mode
    New-MaintenanceWindow : Cannot bind argument to parameter ‘MonitoringObject’ be
    cause it is null.
    At C:\MaintenanceModeV4\AgentMaintenanceModeV4.ps1:30 char:81
    + New-MaintenanceWindow -startTime:$startTime -endTime:$endTime -monitoringObje
    ct:$ <<<< healthServiceWatcher -comment:$comment -Reason:$reason

    =============================================================

    param($rootMS,$computerPrincipalName,$minutes,$comment,$reason)
    Add-PSSnapin “Microsoft.EnterpriseManagement.OperationsManager.Client” -ErrorVariable errSnapin;
    Set-Location “OperationsManagerMonitoring::” -ErrorVariable errSnapin;
    new-managementGroupConnection -ConnectionString:$rootMS -ErrorVariable errSnapin;
    set-location $rootMS -ErrorVariable errSnapin;
    $computerClass = get-monitoringclass -name:Microsoft.Windows.Computer
    $healthServiceClass = get-monitoringclass -name:Microsoft.SystemCenter.HealthService
    $healthServiceWatcherClass = get-monitoringclass -name:Microsoft.SystemCenter.HealthServiceWatcher
    $computerCriteria = “PrincipalName='” + $computerPrincipalName + “‘”
    $computer = get-monitoringobject -monitoringclass:$computerClass -criteria:$computerCriteria
    $healthServices = $computer.GetRelatedMonitoringObjects($healthServiceClass)
    $healthService = $healthServices[0]
    $healthServiceCriteria = “HealthServiceName='” + $computerPrincipalName + “‘”
    $healthServiceWatcher = get-monitoringobject -monitoringclass:$healthServiceWatcherClass -criteria:$healthServiceCriteria
    $startTime = [System.DateTime]::Now
    $endTime = $startTime.AddMinutes($minutes)

    “Putting ” + $computerPrincipalName + ” into maintenance mode”
    New-MaintenanceWindow -startTime:$startTime -endTime:$endTime -monitoringObject:$computer -comment:$comment -Reason:$reason

    “Putting the associated health service into maintenance mode”
    New-MaintenanceWindow -startTime:$startTime -endTime:$endTime -monitoringObject:$healthService -comment:$comment -Reason:$reason

    “Putting the associated health service watcher into maintenance mode”
    New-MaintenanceWindow -startTime:$startTime -endTime:$endTime -monitoringObject:$healthServiceWatcher -comment:$comment -Reason:$reason

  4. Hi Tim:

    I figured out that if I am using the FQDN instead of netbios name, it works.

    However, I have one question. Your program is setting the default location of the powershell program to c:\windows and I need to change that to c:\win2k. What do I change to give correct location of the powershell program?

    Thanks,

    David

  5. Does this tool also put the health service and health service watcher into maintenance mode for the specified server?

  6. It doesn’t look like this tool puts the health service and health service watcher into maintenance mode for the specified server. I still receive heartbeat failure notifications when I shedule a server for maintenance mode. Can the health service and health service watcher be added into this utility?

  7. Yes it does puts the health service and health service watcher into maintenance mode for the specified server. Are the scripts firing correctly? Did you try to fire the scripts outside of a scheduled task?

  8. Sorry… I took a look at script now. I see that it does include the health service and health service watcher. The reason it wasn’t working is because I was receiving the “Security Warning”, I unblocked the file and all is well. Thanks.

  9. Nice tool but 1 draw back i’ve noticed.
    It creates the scheduled task on the task server to run using the specified credentials but it uses the account you are logged on as to connect to the task server in order to create it – hence doesn’t work.
    In our environment our normal logon accounts don’t have access to servers. We have admin accounts for this.
    We could run the scheduled tasks on our local PCs but for centralisation and managment this is not good. What happens if a patch goes out overnight and my pc gets rebooted? The task might not run.
    Runas doesn’t work easily for this tool either. I have to runas my cmd line as my admin account and then cd to the shortcut and run that – pain in the neck.
    The only alternative i can see is have everyone login to the task server and use the tool from there but again only 2 (or 3) users connecting at once via RDP.

    I’m sure in most environments this works a treat.
    Has anyone else come across this issue? Thanks

  10. The scheduler is a fantastic tool. But in our case it doesn’t work properly.
    It seems that the script started successfully but the target server is not
    set in a maintenance mode. I have tried several times with different accounts
    on different group and on single server the result is the same. I installed
    the scheduler according to your instruction. What is goes wrong. Is there any
    log file to look?

    Thanks,
    Samson

  11. Hi
    Was attempting to install onto our new test bench to see if it fulfills our Maintainance Mode problem.. However it fails at the first hurdle 1) Tries to load .net 3.5 (even thought we hve it installed) then the scheduler setup failes with “application requires that assembly system.core version 3.5.0.0 be installed in the GAC first.”
    All the best
    Hans

  12. I agree with Ross, any chance the next release will have the run-as option? We have people in our datacenter that do the monthly server patching and I would like to let them use this tool. They have an admin account and a regular account. There admin account as admin access to the RMS but there regular account does not. So for this scheduler tool to work they would have to be logged into their machine with there admin account. Right now i have their regular account as admins on the RMS but this is not ideal for many reasons. A run as option would make this tool PERFECT. otherwise for the rest of us admins it has worked flawless. Thanks

  13. Nevermind about my last post, i got it working. The run-as option does not work with the shortcut that is created during install. If you go to the following directory C:\Documents and Settings\Yourname\Local Settings\Apps\2.0\5EK5NR3C.LTB\LH93A6KO.OGA\scom..tion_bfe6b84180b2a09d_0002.0000_1929c92e134b4a91
    and copy the scom scheduler exe to your desktop and shift\right click the run as option is there and it works. So it is now completely flawless.

  14. Chris and Ross you can do a run as if you search for the actual executable or run process explorer to find it. It is stored in your profile. Once you find it you can even create a new shortcut that has the ability to use run as.

    Mine is under

    C:\Users\tmcfadden\AppData\Local\Apps\2.0\71VQGZ58.OLE\K26N56H6.6VB\scom..tion_bfe6b84180b2a09d_0002.0000_7a7212912dc1142f\Scom Scheduler.exe

    XP might be something like

    C:\Documents and Settings\tmcfadden\AppData\Local\Apps\2.0\71VQGZ58.OLE\K26N56H6.6VB\scom..tion_bfe6b84180b2a09d_0002.0000_7a7212912dc1142f\Scom Scheduler.exe

  15. I am having the same issue as Samson, it did not put the target server in to maint. even I have admin right on task server and target server, I am running the scheduler from my PC that is in the same domain as the servers and the same ID,
    Any one knows why and the solution?
    Thank you in advance,

    Manjun

  16. Hello
    Is it possible to specify a single server to place into maintenance mode with the tool instead of a group?
    Thanks
    Ben

  17. Hi,

    Setting maintenance mode for a group has given mixed results, it isn’t working for the domain controllers groups. To troubleshoot I’ve copied the cmd directly from scheduled tasks and run directly within powershell. The following is returned:

    0 computers found in the ‘XXX-XXX-XXXXXX XXXXX XXXXX’ group

    There are definitely group members, ie View Group Members works within the console; with dynamic group memberships.

    Setting maintenance mode on computers and other groups appears to be working fine. The spaces in the group name hasn’t been a problem for other groups, only the Domain Controllers group. An option would be just to create separate tasks for each DC.

    Any ideas? Thanks..

  18. Can this be used for SNMP devices, ie if i select a computer but enter the device name or is it ony specific to server objects?

  19. Have been running this tool on SCOM 2007 environment and found it extremely usefull. Last week we upgraded to SCOM 2007 R2 and now this tool does not seem to work any more. Have commands changed in R2? Are there modifications that can/need to be made for this tool to function correctly with R2?

    Thanks

    • I am working on a new version that supports R2. The new version has a bunch of new features and should be out soon.

      – Tim

  20. Hi,
    THis is such a great little tool!

    2 requests though:
    1. Make the window wider, or at least possible to widen it. Our group names are loooong…
    2. Make it possible to set the taskserver/RMS server on a per-computer basis so that all operators are sure to use the same computers for tasks and RMS connection…

    Any chance you’ll release the source code for this so others can contribute?

    Good woork!

    Regards,
    Trond Hindenes / Norway

  21. Hello,

    It is the tool I was looking for, so I did the first steps but now I am blocked with an error:
    The files name, directory name, or volume label syntax is incorrect (EXCEPTION FROM HRESULTS 0x8007007B

    Let me know,
    Thanks,
    Dom

  22. Hello,

    I tried per computer and I did not get the error. So it was per group I got the issue.
    Should I see the wrench also within the SCOM Console? so far after 4 minutes I do not have it…

    Thanks,
    Dom

  23. There seems to be a problem with the display/definition of the Start-time in case one has defined a 24-hour clock. I don’t see AM or PM displayed after the time, but the time is not given in 24-hour format either. So it’s rather confusing, and not clear whether the time AM or PM is used.

    Regards,
    Kees

  24. Any word on that r2 version? I am really in need of some kind of schedule. I have reboots occuring automatically for groups of computers almost every night, and my admins are getting very annoied wiht the heartbeat alerts for know reboots.

    Thanks!

  25. We also love this app, but i have one lite question. If i use the app and put all servers into maintence mode for 4 hours, but after 2 hours all my work is done and now i want to remove the maintence mode on all servers. Is there a simple way of doing that?

  26. Hello all,

    I am trying to modify the powershell script to act on a monitor created by the Management Pack Template “Web Application”. First I run

    $monitoringclass = get-monitoringclass -name:Microsoft.SystemCenter.WebApplication.Perspective

    Followed by

    $monitoringobject = get-monitoringobject -monitoringclass:$monitoringclass -criteria:”SCS Web Other – iExpense”

    The second statement fails. When I run it interactively, I get this message:

    Get-MonitoringObject : The specified MonitoringClass ‘Microsoft.SystemCenter.Web
    lication.Perspective’ is not supported because it is abstract.”

    I’m not sure I understand what this means. Can anyone explain the issue or offer any workarounds? Any info would be greatly appreciated.

  27. Awesome tool! I have installed on my computer (running R2). It says “success” when i create it, but it doesnt seem to get into maint. mode.

    Also, the time is a little confusing. How do i set it in mm from 13.30 – 14.00 for instance?

    Thanks a lot!

  28. Hello, Has anyone installed and attempted to use the SCOM scheduler with and get the following error upon creating a new task.

    “Access is Denied: (Exception from HRRESULT: 0x80070005 (E_ACESSDENIED))

  29. Hello, after installing the scheduler, I ge the following error when creating a task,

    Access is Denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

    Any ideas??

    Thx

  30. Looks likeit would be a great tool, but when I try to run it from the Computer tab I am getting “Network address invalid.” Not sure what to do about that. I tried using teh FQDN for the RMS server – didn’t make a difference. Thanks for any help that you might be able to give.

  31. Hello,

    I tried per computers and everything works well.
    When I try to use a group after browsing the list of group I am getting an error:
    “Object reference not set to an instance of an object.”

    What am I missing?
    Thanks,
    Dom

  32. Okay Tim I found your comments “Only groups in unsealed management packs will show up” the nested group is a sealed MP so it might be why the machines did not get the MM scheduled, isn’t it?
    Anyway your tool is fantastic… ane very helpful all times…

    Thanks,
    Dom

  33. It doesnt seem to like any groups with spaces in them which is nearly all of them. I get a Group ‘testing 123’ not found. Works fine for groups which dont have spaces.

  34. Hi! I have installed it as describe in the document but it don’t work when I scheduler it. It work when I run the command manually as it says in the “Show Scheduler Tasks” under “Program File” and “Command Line”. The task egine windows just flash with some red text, I don’t get time to see the message.

  35. Hi! Have solved my problem now. I needed to put some text in “Comment”.

    One other thing: Do you think that you will update this script/program to also have the possibility to just put one application into Maintenance Mode for one server.

  36. Great tool ! Could you please add linux machine in the “get-computer” query of your next version ?

    Thanks

    Frank

  37. Hi, this tool is great but can you schedule to maint mode on monthly basis aswell as the current once/daily/weekly option?

    As a workaround, could I use the tool to create the schedule and then use Task Scheduler to go in and edit the trigger to the monthly requirements?

    Cheers

  38. Hi Guys,
    I have a question in regard VMs on a cluster
    1.Can scom start maintance mode for the server in the cluster if a physical switch fail.
    2.How t trigger scom to move vm with scvmm.
    3.Is there script how to detect netwrok failures.
    Thnaks

  39. I have tried to run this and I am running 2007 R2 of Ops manager. I am getting an informational stating the task stopping due to timeout reached. And it has never put the system into maintenance mode. I am using an account that is on a machine I am trying to run this against. Anyone have any suggestions.

  40. It is not practical for us to create combination of server groups in SCOM (i.e. few AD, SQL, Exchange, IIS etc) every time we need to put them in maintenance mode. There is a potential of performance hit by creating too many groups in SCOM so It would be really nice/helpful to allow us to use/import a server list (excel, txt, csv etc) instead of groups or single computer etc.

    Here is a use case for this requirement: We have about 600 Windows servers running different roles/applications and are being managed/administered by different application owners/groups. They are responsible for installing/uninstalling/configuring there apps and whenever they need to put their servers in MM they should be able to just use a list of servers as suppose to SCOM admin creating a group for each app/server owner.

  41. I have tried to use a group with only SQL Server and SQL Agent members included.
    The reason for this to avoid alerts while running sql backup but to keep monitoring running for the rest of the maschine.
    Now I found out that your ps-sript for group only looks for class windows computers.
    Maybe you can add another tab like group for objects or change the ps script for include more than only windows computers.
    The idea from Frankg is good. We have too Linux maschines.

    Is there a Lifecycle plan for this tool ?
    Thanks,

    Bernd

  42. Application doesn’t work locally or remotely when the Security Policy “Network access: Do not allow storage of credentials or .NET Passports for network authentication ” is set to Enabled. This pretty much kills this applications value in our environment if there’s not a workaround for it.

    I too also get the Access Denied error trying to reach out to the target server, even if I’m running it locally as an Administrator account that as Admin level access to the target server.

  43. Hi! How can I use 24 hours time stamp in the start time options? We use 24 hours time stamp in our server in Sweden.

  44. This tool seems to work great for server objects, but I can’t seem to get other objects (like icmp) to go into maintenance mode with this tool. If I add the icmp objects into a group, and schedule a task, the task will run, however, the icmp objects never seem go into maintenance mode. Am I missing something or is this not part of the functionality of this tool?
    Looking forward to your response. 🙂

  45. I have the same problem as MichaelW.

    We have a dynamic group that is populated withh all agents using “( Object is Agent AND True )”.
    In the OpsMgr Ops Console it is populated with members – but when running the command manually:

    C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe C:\MaintenanceModeV4\GroupMaintenanceModeV4.ps1 -rootMS: ‘omms-01’ -groupName: ‘All Agents’ -minutes:240 -comment: ‘Maintenance Window 01-05’ -reason: ‘PlannedOther’ -startMM:$true

    I get the message:
    0 computers found in the ‘ADP – All Agents’ group

    Will the script not work with dynamic groups?

    Thanks for any help!

    /Nicolaj

  46. Nicolaj,

    The scripts should be able to pick up the members in the group. Although, I’m having the same problem others have mentioned regarding spaces in the group names in my case. However, I tracked that down as being due to running the script from Powershell 1.0 under Windows 2003 R2 directly as opposed to calling Powershell from the Windows command line which is what the scheduled task does.

  47. Hi The problem is I when I use run as to run the application I am able to get through to the GET GROUPS or GET COMPUTERS button but as soon as I click on it I get the error

    ************** Loaded Assemblies **************
    mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4952 (win7RTMGDR.050727-4900)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    —————————————-
    Scom Scheduler
    Assembly Version: 1.7.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/myname/Desktop/Scom%20Scheduler.exe
    —————————————-
    System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    —————————————-
    System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    —————————————-
    System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    —————————————-

    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.

    For example:

    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.

  48. 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.

  49. Great tool.. Found that the maintenance mode works but am unable to see the icon appear in SCOM. Also tasks dont appear to be ending in the duration requested. Often have to end the task manually. Thanks

  50. This had always been a great working tool for me. Recently I changed jobs, and at this new venture I installed the tool for everyone to use. But unfortunately it does not work. Probably because this is win2k8 servers. I tried installing it on the server too, but when I click on create it errors out.
    Under Groups when I click on Create it errors out to – Object Reference not set to an instance of an object
    Under Computers tab When I click on Get computers it errors out – cannot connect to RMS.

    Last week I could schedule it for the groups and not individual computers, but from this week, even the groups i cannot schedule. Anyone experience anything similar?

  51. I was also getting “Object reference not set to an instance of an object.”

    I was putting a time 7:15PM into my comment, once I removed this (I’m guessing the ‘:’ gave it problems) it works fine!

    Thanks for this tool, shame on MS for not including recurring maintenance capability.

  52. I am having the same issues as PhilipL. The tool works great and the script kicks off MM for my specified server. When I look at the server under monitoring it even has the End Time correctly noted however MM doesn’t actually end. Any ideas Tim?

  53. Hi Tim, Great Tool..
    I tried to use it today to schedule some maintenance on servers but when I hit “Get computers” it did not discovered Unix servers but windows servers shows up.
    Is the tool can get Unix servers appeared as well ?

  54. Got the problem with 0 computers found in the group too. Anyone got a solution? I am sure that there are members in the group. When i schedule a task for only 1 computer it works fine.

  55. **Feature Request: The ability to include “Sealed MP Groups” in the app.

    – All my custom MPs are sealed. Due to this I am not able to see any of my groups in the app. Generally I have to just pick one of the groups, go to Task Scheduler and edit the parameters to include the groups from the sealed MP that I want. Otherwise, loving this tool.

  56. Hello Tim,

    I am trying to use the Groups but the machine does not show the for “Maintenance Mode” I checked the Task Scheduler it is in and ran okay… I checked the SCOM Scheduler it is listed as done…

    Any over troubleshooting steps to see why I do not see the maintenance Mode Symbol listed!!!
    Thanks,
    Dom

  57. The task is created in task scheduler, however it will not run from the task scheduler. I click run, it appears to sucessfully complete but nothing happens.
    If run in Windows PowerShell:
    C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe C:\MaintenanceModeV4\AgentMaintenanceModeV4.ps1 –rootMS: ‘RMS Server’ -computerPrincipalName: ‘ServerName’ -minutes:6 -comment: ‘Job Name’ -reason: ‘PlannedOther’
    It works fine and the server is put into maintenance mode.
    Both Agent and Server have ExecutionPolicy set to unrestricted.
    Why won’t it run for task scheduler? Please help! Thanks.

  58. Will you design this for SCOM 2012? I have a lab and it does not seem to be working. Also can I create any sort of group of items and put them in MM? IE. Put this APP Pool, IIS server and Sites into MM.

  59. Agent/GroupMaintenanceModeV4.ps1 script works for servers into maintenance in our environment. I have also found more script for web application maitenance URLMaintenanceModeV4.zip and it works without any problem.

    I’m not powershell guru, is it possible to combine those two scripts into one?

  60. I have mix a litte bit + Automatically Starting Maintenance Mode When Servers are Rebooted for Patching « Operating-Quadrant:

    I have made a solutions that works on 500 server and quick.

    ———————————
    A Subscription / monitor

    EVENT ID 1074

    ————————————-

    A have made a Channel command (Powershell)

    D:\auto\xxxx.ps1 –rootMS: ‘xxx-rms01’ -computerPrincipalName: ‘$Data/Context/DataItem/ManagedEntityDisplayName$’ -minutes:5 -comment: ‘Server is being restarted, and will be in maintenance mode for 5 minutes from $Data/Context/DataItem/TimeRaisedLocal$ ‘ -reason: ‘PlannedOther’

    ————————————-

    Script (xxxx.ps1)

    param($rootMS,$computerPrincipalName,$minutes,$comment,$reason)

    Add-PSSnapin “Microsoft.EnterpriseManagement.OperationsManager.Client” -ErrorVariable errSnapin;
    Set-Location “OperationsManagerMonitoring::” -ErrorVariable errSnapin;
    new-managementGroupConnection -ConnectionString:$rootMS -ErrorVariable errSnapin;
    set-location $rootMS -ErrorVariable errSnapin;

    $computerClass = get-monitoringclass -name:Microsoft.Windows.Computer

    $computerCriteria = “PrincipalName=’” + $computerPrincipalName + “‘”
    $computer = get-monitoringobject -monitoringclass:$computerClass -criteria:$computerCriteria

    $startTime = [System.DateTime]::Now
    $endTime = $startTime.AddMinutes($minutes)

    if($computer.InMaintenanceMode -eq $false)
    {
    “Putting ” + $computerPrincipalName + ” into maintenance mode”
    New-MaintenanceWindow -startTime:$startTime -endTime:$endTime -comment:$comment -Reason:$reason -monitoringObject:$computer
    }

  61. Hell Folks, This Tool is working Nice but i have one small problem.
    On the Schedule set time, i see once PS Script is running but it’s prompting for me to press R for Running this Script. How can we set so that it’s always run without any confirmation.

    Thanks in Advance…

  62. Hi Tim, this tool is great! Have you an example of how to modify the script to pick up all objects in a specified group regardless of what type of objects they are?

    I have a need to schedule maintenance mode but my need is not for computer objects. It is for: IIS Server, IIS Website, IIS Application Pool and some F5 LTM Pool Members in addition to some Web Transaction objects.

  63. Hi Tim, just an update. I got the tool to work successfully only if something is entered in the Comment field. If the comment field is left blank, the task appears to run successfully but nothing happens.

    Only by running the script with its’ arguments manually do you find that if the -comment parameter is invoked, it cannot be null.

  64. this script doesn’t work for me for my unix boxes. I modified the script and replaced $windowsComputerClass variable with $unixComputerClass and changed where this is set to Microsoft.Unix.Computer instead of Microsoft.Windows.Computer class. This works, but in its default state, the script does not work for unix agents. -Redi

  65. Thanks for that greate tool! It works pretty perfect, the only thing is that the start time is not complete. I cannot see if the time is am or pm. Do you know where the error is? i have a german OS.
    Maybe it is possible to change the time from am/pm to 0-24?

    Best regards
    Alex

  66. I’ve run into a problem with the scheduler, it’s not putting computers or groups into maintenance mode, has been working for a couple of years ok up until now and everything looks normal as far as I can see apart from this.

    Looked at the Powershell event log and I see a number ‘Provider’ started entries for Powershell events occurring at the scheduled time, however these are quickly followed by ‘Provider’ stopped entries 4 seconds later. Just wondered if this is normal behaviour or a sign of something wrong?

    Are you able to provide me with any pointers to potential solutions.

    Great solution by the way, much appreciated.

  67. I have 2 questions:

    Is there any plan to update this tool for SCOM 2012?
    It still seems to function with 2012 but wanted to know if an update was coming.

    Would it be possible to add 1st, 2nd, 3rd, 4th, Last / Sun, Mon, Tue, etc?

  68. I’m experiencing issues when using this tool for Windows Cluster servers. We receive “cluster is offline (severity critical) or partially online (severity warning)” alerts.

    Is anyone using this tool with Windows clusters?

  69. Tim,
    Is there a way to use this tool without having to have an account as a scom admin? I would like to have this tool in the hands of a normal support person since they are the ones bouncing the server not the scom admin’s.

    Thanks
    Ross

  70. a really great tool!
    but unfortunately we cannot use the tool because our servers are working with 24h time-format (european time-zone).
    will this “issue” be fixed?
    thanks…..

  71. After running this step:

    $computer = get-monitoringobject -monitoringclass:$computerClass -criteria:$computerCriteria

    I found $computer is null/empty. Though, $computerCriteria and $computerClass show correct values. $computerCriteria is PrincipalName=’=’TESTSERVER’
    .. and $computerClass has Name : Microsoft.Windows.Computer and Description : All Windows Computers

    I dont get any errors either. What value should we see in $computer ?

    All other steps seem to work OK. Please help. Any pointers?

  72. This appears to work with SCOM 2012. I’m having some trouble with dynamic inclusion, though. It appears that if I put machines into the Explicit Members part of the group, it works just fine. I recently switched to dynamic inclusion though and now the tool won’t put the group in MM. The tool seems to execute just fine and the group is populating correctly. Am I missing something?

  73. I figured it out. I didn’t put a comment in before creating the task, so the script did not fully execute.
    So yes, it does work on SCOM 2012. The only thing is that it tends to put the RMS server into MM if it happens to be in the group, despite there being code to check for that.
    Aside from that, it works great. Thanks so much!

  74. Hi All,

    I am planning to deploy this tool in my environment. My requirement is

    1. Heartbeat for the specific server or Group of servers should not stop while the server in maintenance mode. I want alerts if any server goes down ( shutdown) in a group while in maintenance mode window. Can I do it ?

    What are the changes I have to do ? Please help me.

    Thanks in Advance

  75. Hi

    just followed the instructions on importing the MPs and I’m getting a Status Error when trying to import the SCOM2012 Maintenance Mode Scheduler Dashboard MP (the other one imported fine). It says that the Microsoft.SystemCenter.Visualizaton.Compoment.Library and Microsoft.SystemCenter.Visualization.Library MPs are missing. They’re not, and all other MPs/Dashboards are working fine on my SCOM 2012 R2 (fully patched) system.

    Have you seen this before?

    Thanks

    Ken Z

Leave a Reply

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