Management Pack for the SCOM 2012 Maintenance Mode Scheduler

Written by Tao Yang

I’ve been working on a SCOM management pack during my spare time over the last couple of weeks. This management pack provides some basic monitoring for the SCOM 2012 Maintenance Mode Scheduler Version 2 developed by Tim McFadden (http://www.scom2k7.com/scom-2012-maintenance-mode-scheduler-2/).

The purpose of this MP solution is to help this web-based maintenance mode scheduler integrate better within SCOM. The solution contains 2 management pack files. The following items are included:

Class definitions and discoveries for the SCOM 2012 Maintenance Mode Scheduler.

The monitoring MP defines 2 classes. a Microsoft.Windows.ComputerRole based class called “SCOM 2012 Maintenance Mode Scheduler”, which has many properties defined representing various application settings.

image

There is also an unhosted class called “SCOM 2012 Maintenance Mode Scheduler Event Collector”. This class runs an event collection rule which collects the new schedule jobs creation events even when the Maintenance Mode Scheduler computer is in maintenance mode.

Automatically delete any finished maintenance mode schedules

A rule runs once a day and executes a script to scan through all Windows Scheduled Tasks created by the maintenance mode scheduler and deletes any tasks that does not have a Next Run Time (i.e. tasks that only runs once and it has already be executed). For auditing purposes, when deleting each old (finished) task, an event is also written to both SCOM operational and Data Warehouse databases.

The purpose of this rule is to eliminate the needs for manual clean-up of old scheduled tasks created by the maintenance mode scheduler.

Event Collection rule for new schedule job creation events (Event ID 711)

When the Maintenance Mode Scheduler is configure to write auditing events to Windows event log, a event collection rule can be utilized to collect these events and store them in SCOM databases.

image image

Monitor the credential of SCOM Data Access Account configured in the maintenance mode scheduler.

A monitor that checks if the credential of the SCOM Data Access Account configured in SCOM 2012 Maintenance Mode Scheduler is still valid. This is to ensure SCOM operators get notified if the Data Access account password has been changed, or the account has been locked out, disabled or deleted.

Monitor if the SCOM Data Access Account has local administrator privilege on the computer hosting the maintenance mode scheduler.

A monitor that checks if the SCOM Data Access Account configured in SCOM 2012 Maintenance Mode Scheduler has local administrator privilege on the computer hosting the scheduler. Windows local administrator access is required to create Windows Scheduled task.

Console task to launch the SCOM 2012 Maintenance Mode Scheduler web site using the default web browser.

image

New scheduler jobs event report

image

Maintenance Mode Scheduler dashboard (Provided by the SCOM 2012 Maintenance Mode Scheduler Dashboard management pack).

image

This dashboard contains:

  • Maintenance Mode Scheduler state widget
  • PowerShell Grid widget that lists new schedule jobs events
  • PowerShell Web Browser widget that displays the Maintenance Mode Scheduler web page.

Maintenance Mode Scheduler State view

SNAGHTML199224ed

New Jobs Event View

SNAGHTML1992f8d7

Deleted Jobs Event view

SNAGHTML19946112

Credit

I’d like to thank Tim McFadden for producing such a good maintenance mode tool for SCOM 2012, and also the valuable feedbacks and suggestions provided for this management pack.

Conclusion

For me, while I was writing this MP, I’ve accomplished few of my “firsts”:

  • First time writing scripts for IIS (as this is a web based application).
  • First time writing reports in VSAE (I have to say for me, it is much easier than using old Authoring console)
  • First time using the new PowerShell widgets from the SCOM 2012 R2 UR2 updates (well, they’ve only just come out).

So I was really enjoying it, although it took a lot longer than what I expected (due to the IIS scripting challenges I had).

I hope this management pack would help the community to better adopt and integrate the SCOM 2012 Maintenance Mode Scheduler into their SCOM 2012 environments.

The Management packs and documentation can be downloaded HERE. Please make sure you read the documentation before importing the MPs. there are few pre-requisites for the MPs.

Lastly, as always, please feel free to contact me if you have issues / questions / suggestions.

17 comments on “Management Pack for the SCOM 2012 Maintenance Mode Scheduler

  1. Pingback: Management Pack for the SCOM 2012 Maintenance Mode Scheduler | Everything System Center Operations Manager by Tim McFadden

  2. tao,

    I tried to import the scom2012.maintenance.Mode.scheduler.Dashboard and and raised a error. This management pack does not work on scom 2012 sp1? I have installed the update rollup 6, however the mp dashboard ask for 7.1.10226.1015 version to Microsoft.SystemCenter.Visualization.Component.Library and Microsoft.SystemCenter.Visualization.Library MP. The current version for ur6 scom 2012 sp1 is 7.0.9538.1109

    • Hi Arthur,
      I created the dashboard in a R2 UR2 environment. I wasn’t sure if it will work in SP1 UR6 as stated in section 6 of the documentation. you can try to unseal the dashboard MP and change the reference MP version number. Please let me know if it works.

  3. Tao,

    I have unsealed the dashboard mp and changed de reference MP version number according to you recommendation. After that, I imported successfully the mp. However, the dashboard view does not appear any objects or web page config. All prerequisites are ok. Do you have any more suggestions? I think that I´ll need to migrate to R2 version 🙁

  4. Hi Tao,
    I’ve recently imported your Management packs to test out Tim’s MMS tool (which is superb) however I get the following powershell error during discovery.
    The PowerShell script failed with below exception

    System.Management.Automation.RuntimeException: Account “” does not have User Principal Name configured. Script cannot continue. Aborting…
    At line:45 char:10
    + Throw <<<< $ErrMsg
    at System.Management.Automation.FlowControlNode.Execute(Array input, Pipe outputPipe, ExecutionContext context)
    at System.Management.Automation.ParseTreeNode.Execute(Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)
    at System.Management.Automation.StatementListNode.ExecuteStatement(ParseTreeNode statement, Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)

    Script Name: DASAccountStatusProbe.ps1

    Any ideas what could be causing this? I'v extracted script from the MP and stepped through it manually and it can pull back the UPN of the account being used. So I'm doubly confused.
    The Account is a domain account which is a member of the Local administrators group. The web application is installed on a Management Server. OS is 2008 R2
    Thanks.

    • Hi Phil,

      I had the same issue in my lab: the DAS/SDK service account did not have a UPN (@). it only had a pre 2000 logon name format \. if this is the case, please update the service account in AD.

      • Hi Tao,
        Thanks for the quick reply. I can confirm my DAS/SDK Account does already have a UPN.
        However we have multiple UPN’s in our Domain, could this be an issue?
        Exporting the MP and copying the script out and running it manually appears to work. Certainly the variables ion the script are all populated correctly with results.

      • Hi Tao,
        While Troubleshooting my issue I’ve noticed a small typo in your DASAccountStatusProbe.ps1 script
        The Line;
        $ErrMsg = “Account ‘”$DASUserName'” does not have User Principal Name configured. Script cannot continue. Aborting…”

        Has some odd extra quotes around the $DASUserName variable which leads to the error message having a blank user name ” ”
        Being able to see which user name the script thinks it’s failing would be great an help a lot in my trying to work out why this doesn’t work in my environment.
        Thanks for the great work

  5. OK Thanks sorry for getting it wrong. Feel free to delete my posts if it clutters up the site 🙂

    • Hi – strongly recommend that you check that your backticks are natively UTF/ASCII values. I’ve been caught by this many times when copying stuff between web pages and ASCII editors. Just a thought.

  6. Hi Tao,

    We too are seeing the PowerShell Script Failed to Run error assosdciated with the DAS account. Text of the error below:

    The PowerShell script failed with below exception

    System.Management.Automation.RuntimeException: Account “DOMAIN\DASACCOUNT” does not have User Principal Name configured. Script cannot continue. Aborting…At line:45 char:5
    + Throw $ErrMsg
    + ~~~~~~~~~~~~~
    at System.Management.Automation.Interpreter.ThrowInstruction.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

    I have asked the Windows Admins and theyhave verified that the DAS account does indeed have a UPN account and that it is not a pre 2000 logon name format. We do however have DC running on Windows 2008 and Windows 2012. We also notice that the Heath State monitor for the Maintenance Mode Scheduler in the dashboard is permanently stuck in an empty circle icon (unmonitored).

    Also, when we look at the Schedule Maintenance Mode view thgew actual web page is missing the top-most section of the tool including the buttons allowing you to change the target object to place into maintenance mode so the only option seems to be to schedule a single computer into maintenance mode.

    Can you please suggest what may be wrong?

    Kind Regards,

    Michael

  7. I also have the same error and the account has a UPN. Does the account name need to be entered in UPN format when configuring the scheduler ?

Leave a Reply