Exchange 2016 Maintenance Mode

Put the server in maintenance mode

  1. Drain the mail queues on the server.
    1. Set-ServerComponentState SRV-RU-EX0 -Component HubTransport -State Draining -Requester Maintenance
  2. MS recommends restarting the transport services to help this change immediately take effect.
    1. Restart-Service MSExchangeTransport
    2. Restart-Service MSExchangeFrontEndTransport
  3. Redirect pending messages to another Mailbox server.
    1. Redirect-Message -Server SRV-RU-EX0 Target SRV-RU-EX06.example.com
  4. Pause the DAG node.
    1. Suspend-ClusterNode SRV-RU-EX0
  5. Move all the active databases off of the server to another DAG member.
    1. Set-MailboxServer SRV-RU-EX0 -DatabaseCopyActivationDisabledAndMoveNow $True
  6. Look at the status of the database auto activation policy. Keep this handy. We will need this when we take the server out of maintenance mode.
    1. Get-MailboxServer SRV-RU-EX0 | Select DatabaseCopyAutoActivationPolicy
  7. Block the server from hosting active database copies.
    1. Set-MailboxServer SRV-RU-EX0 -DatabaseCopyAutoActivationPolicy Blocked
  8. Place the server in maintenance mode.
    1. Set-ServerComponentState SRV-RU-EX0 -Component ServerWideOffline -State Inactive -Requester Maintenance

Take the server out of maintenance mode

  1. Take the server out of maintenance mode
    1. Set-ServerComponentState SRV-RU-EX0 -Component ServerWideOffline -State Active -Requester Maintenance
  2. Unpause the DAG node.
    1. Resume-ClusterNode SRV-RU-EX0
  3. Set the server to allow database copy activation
    1. Set-MailboxServer SRV-RU-EX0 -DatabaseCopyActivationDisabledAndMoveNow $False
  4. Set the database auto activation policy back to its original setting. If it was set to blocked previously, leave it set that way. The default policy is Unrestricted
    1. Set-MailboxServer SRV-RU-EX0 -DatabaseCopyAutoActivationPolicy Unrestricted
  5. Set the hub transport component back to active to allow it to accept connections.
    1. Set-ServerComponentState SRV-RU-EX0 -Component HubTransport -State Active -Requester Maintenance
  6. Again, MS recommends that the transport services be restarted to help this change get picked up immediately.
    1. Restart-Service MSExchangeTransport
    2. Restart-Service MSExchangeFrontEndTransport