Start-DAGMaintenanceMode and Stop-DAGMaintenanceMode

These two are really good functions. While I just used others’ code, I do give them credit, but to be able to ‘function these up’ is very handy. Not that I’m lazy…OK, I’m efficient, but having verb-noun at your fingertips, whenever you need to run something, is very convenient.

Furthermore, I can’t tell you how many times I still run into Exchange engineers, that do not put their servers into maintenance mode. They simply just start a Cumulative Update (CU), bounce the box, and hope all works. Well, potentially, you can run into issues and cause minor disruptions to your end users. And none of us like phone calls. Consequently, you should always proactively start and stop your servers, so they gracefully shut down, release their services, and communicate properly to other DAG members in the organization that they are not available for workload responsibilities.

To start the DAG maintenance mode on a server, to be able to install a CU or any Windows updates, simply type in:

Start-DAGMaintenanceMode

You can either be logged in on the server with the MO_Module installed, or simply have a remote PowerShell session into an Exchange server, and then run the function from there, with the server parameter:

Start-DAGMaintenanceMode -Server <NameOfServer>

The function performs several steps and ensures the Exchange server has properly moved the active databases to another DAG node, not allowed client connections, and completed any open transport tasks. Once the server is no longer serving any services to anyone or any applications, then it is safe to install updates and/or restart the server.

Once the updates have been installed and after any required reboots have occurred, then simply run this function to stop the maintenance mode:

Stop-DAGMaintenanceMode

And that’s it. The server is put back into the client pool to receive connections, mounted the databases, and be part of the transport services of the DAG.

You can also rebalance any active DB’s now, or just wait until the Exchange server process performs the task for you. And since you may have several other servers to complete updates with, you can just wait until those are done.

These two functions are part of the MO_Module that helps administrators with their daily tasks. You can run the code below to install the module at a PowerShell prompt, while running PS as an administrator:

Install-Module -name MO_Module

If you have any additional questions about the functions, just run Get-Help against them. I make sure all functions have help topics, including examples.

Get-Help Start-DAGMainenanceMode -Full

I've also been updating the -online parameter pages for both Start-DAGMaintenance and Stop-Maintenance, including all of the other MO_Module functions.

I hope this makes your quarterly patching of Exchange Server CU’s easier and less errors or disruptions for your end users.

Mike