SharePoint Maintainence Window

How does the maintenance window work?

The SharePoint maintenance window was an addition to SharePoint Sever 2013 however not many company’s know about. It provides users with a toolbar notification that notifies them of upcoming admin maintenance which can be more convenient than having to use alternate methods such as company wide emails. The message that shows up gets posted to the users at the content database level, however does include its drawbacks. One of the drawbacks of this is that it is not very customisable so you cannot compose a custom message however will allow you to specify the notification start/end date, as well as the starting/ending date of the maintenance itself.

A basic message will usually have the following information:

  • The duration of the maintenance – provides information about how many days/hours/minutes the maintenance will last.
  • Maintenance start date – provides information on when the maintenance will begin which will be displayed in the American format ( MM/DD/YYYY HH:MM:SS AM|PM)
  • Maintenance end date – provides information on when the maintenance will end which will be displayed in the American format (MM/DD/YYYY HH:MM:SS AM|PM)
  • The type of maintenance – This will provide information on which type of maintenance is being completed out of the two options ‘planned maintenance’ and ‘warning of maintenance’.

A planned maintenance message will look something like the following:

A warning maintenance message will look something like:

To set this up you can run the following commands in SharePoint powershell:

$Window = New-Object Microsoft.SharePoint.Administration.SPMaintenanceWindow

$Window.MaintenanceStartDate = “05/31/2018 10:00:00 PM”

$Window.MaintenanceEndDate = “06/01/2018 07:00:00 AM”

$Window.NotificationStartDate = “05/17/2018 01:00:00 AM”

$Window.NotificationEndDate = “06/01/2018 07:00:00 AM”

$Window.MaintenanceType = “MaintenanceWarning”

 

Get-SPContentDatabase | % {

    $_.MaintenanceWindows.Clear()

    $_.MaintenanceWindows.Add($Window)

    $_.Update()

}

About the author