During a presentation in Florida I was asked a question about the upcoming scheduled Maintenance Mode functionality in Operations Manager vNext. This blog post will cover the following topics related to the new Scheduled Maintenance mode functionality:

  1. Where are maintenance schedules defined?
  2. Is it possible to create a schedule for the 3rd Tuesday of every month?
  3. Where is the scheduled maintenance information stored?
  4. Are there stored procedures for Scheduled Maintenance?
  5. How do the stored procedures work with SQL?
  6. What permissions are required? Any gotcha’s?
  7. New PowerShell cmdlets in OpsMgr vNext

 

Where are maintenance schedules defined in OpsMgr vNext?

Maintenance schedules are defined in the Operations Manager console, administration pane, under maintenance schedules as shown below:

To create a new one use the Create Maintenance Schedule task available in this section of the administration pane.

 

Is it possible to create a schedule for the 3rd Tuesday of every month?

The question was whether you could create a schedule for the 3rd Tuesday of every month. The answer to that question appears to be a resounding “Yes” as shown in the graphic below.

 

Where is this information stored?

So where is this data stored? This question was explained in the reference links at the end of this blog post but to give a short way to find these, in SQL I used a simple select statement to find the maintenance schedule records.

SELECT * FROM [OperationsManager].[dbo].[MaintenanceModeSchedule]

The results are shown below which includes the following fields: ScheduleID, ScheduleName, Recursive, IsEnabled, Status, IsRecurrence, IsEndTimeSpecified, Duration, ScheduledEndTime, ActiveStartDate, ReasonCode, Comments, User, LastModified.

 

Are there stored procedures for Scheduled Maintenance?

It looks like there are stored procedures around Scheduled Maintenance based up this query of the stored procedures in the database:

SELECT * FROM sys.procedures where name like ‘%MaintenanceSchedule%’

The same query on an Operations Manager 2012 R2 environment came up blank for stored procedures matching this name.

 

How do the stored procedures work with SQL? [Content by Tao Yang]

A review of the stored procedures including the p_MaintenanceScheduleEnable shown below indicated the scheduled maintenance works with SQL jobs.

01

A review of the Job Activity Monitor in the SQL Server Agent indicated that there was one job which had never been executed and it was the only one that was not categorized as a Report Server job (highlighted below).

02

 

The start date matches the schedule which was just created in SCOM:

03

The following SQL job looks like it’s for the maintenance schedule which was just created:

04

0506

In summary, new Scheduled Maintenance tasks appear to be creating SQL Jobs which perform the process to actually perform the maintenance mode.

 

What permissions are required? Any gotcha’s?

There are a couple of important notes to be aware of related to how Scheduled Maintenance works. One from TechNet and one related to the SQL Server Agent service:

  1. From https://technet.microsoft.com/en-us/library/dn997273.aspx Important Information about Maintenance Schedules
  • You can change when a running schedule will end, but the change will only apply to the schedule that is running. If you want to edit the ending time for future runs of that schedule, you must first stop the schedule.
  • The time zone that applies to the Operations Manager Management Server will be applied to the maintenance schedule.
  • Changes to accommodate daylight savings time are not automatically applied to maintenance schedules. You must manually edit the schedule to adjust for daylight savings time changes.
  • You cannot view the schedules that are created through the “Maintenance Mode” task in the “Maintenance Schedules” Pane. However, the schedule for an entity that is actively in maintenance and triggered through the “Maintenance Schedules” pane can be edited or ended through the “Maintenance Mode” task.
  • You can get historical data for when a monitored entity went into maintenance mode by querying the MaintenanceModeHistory table in the Operations Manager database.
  • The System Center Operations Manager SDK action account must have one of the following SQL roles in order to take advantage of the Maintenance Mode feature:
    • SQLAgentUserRole
    • SQLAgentReaderRole
    • SQLAgentOperatorRole

For more information about setting the SDK action account see Account Information for Operations Manager

  1. The use of Agent Jobs also indicates that the SQL Server Agent service needs to be running.

 

New PowerShell cmdlets in vNext: [Content by Tao Yang]

It appears that TP3 also has 9 new cmdlets (182 versus 173). MaintenanceSchedule related cmdlets are listed below: (Disable-SCOMMaintenanceSchedule, Edit- SCOMMaintenanceSchedule, Enable- SCOMMaintenanceSchedule, Get- SCOMMaintenanceSchedule, Get- SCOMMaintenanceScheduleList, New- SCOMMaintenanceSchedule, Remove- SCOMMaintenanceSchedule, Stop- SCOMMaintenanceSchedule, Update- SCOMMaintenanceSchedule)

07

 

Reference Links and Thanks

Thank you to Tao Yang, Stanislav and Scott Moss for their content, insights and thoughts on this topic!

Thanks to the following bloggers who provided information on what they found in TP2 related to Scheduled Maintenance Mode available at:

Additionally, don’t forget the following article from Microsoft (What’s New in OM in Technical Preview):