Exchange 2016 – using maintenance mode for patching a DAG member

When patching an Exchange 2016 server that is a member of a DAG (Database Availability Group) it is best to put the server into maintenance mode before doing so.  This is easily done using a few PowerShell cmdlets:

  1. Drain the mail queues:

    Set-ServerComponentState EX16-01 -Component HubTransport -State Draining -Requester Maintenance

  2. Restart services:

    Restart-Service MSExchangeTransport

  3. Redirect messages to another server

    Restart-Service MSExchangeFrontEndTransport

  4. Redirect messages to another server:

    Redirect-Message -Server EX16-01.mydomain.local -Target ex16-02.mydomain.local

  5. Suspend the cluster node:

    Suspend-ClusterNode EX16-01

  6. Move the databases to another DAG member:

    Set-MailboxServer EX16-01 -DatabaseCopyActivationDisabledAndMoveNow $True

  7. Block the server from hosting the databases:

    Set-MailboxServer EX16-01 -DatabaseCopyAutoActivationPolicy Blocked

  8. Put the server in maintenance mode:

    Set-ServerComponentState EX16-01 -Component ServerWideOffline -State Inactive -Requester Maintenance


Once patching, or other maintenance, is complete, just reverse the process:

  1. Take the server out of maintenance mode:

    Set-ServerComponentState EX16-01 -Component ServerWideOffline -State Active -Requester Maintenance

  2. Resume the cluster node:

    Resume-ClusterNode EX16-01

  3. Allow database copy and activation:

    Set-MailboxServer EX16-01 -DatabaseCopyActivationDisabledAndMoveNow $False

  4. Allow the server to host the databases:

    Set-MailboxServer EX16-01 -DatabaseCopyAutoActivationPolicy Unrestricted

  5. Enable Hub Transport to allow connections:

    Set-ServerComponentState EX16-01 -Component HubTransport -State Active -Requester Maintenance

  6. Restart services:

    Restart-Service MSExchangeTransport
    Restart-Service MSExchangeFrontEndTransport

[BlogBookmark] [Blogsvine] [] [Digg] [Facebook] [Furl] [Google] [LinkedIn] [MySpace] [Reddit] [Slashdot] [StumbleUpon] [Twitter] [Windows Live] [Yahoo!] [Email]