Exchange 2016 Maintenance Mode
Put the server in maintenance mode
Drain the mail queues on the server.Set-ServerComponentState SRV-RU-EX0 -Component HubTransport -State Draining -Requester Maintenance MS recommends restarting the transport services to help this change immediately take effect.Restart-Service MSExchangeTransport Restart-Service MSExchangeFrontEndTransport Redirect pending messages to another Mailbox server.Redirect-Message -Server SRV-RU-EX0 Target SRV-RU-EX06.example.com Pause the DAG node.Suspend-ClusterNode SRV-RU-EX0 Move all the active databases off of the server to another DAG member.Set-MailboxServer SRV-RU-EX0 -DatabaseCopyActivationDisabledAndMoveNow $True 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.Get-MailboxServer SRV-RU-EX0 | Select DatabaseCopyAutoActivationPolicy Block the server from hosting active database copies.Set-MailboxServer SRV-RU-EX0 -DatabaseCopyAutoActivationPolicy Blocked Place the server in maintenance mode.Set-ServerComponentState SRV-RU-EX0 -Component ServerWideOffline -State Inactive -Requester Maintenance
Take the server out of maintenance mode
Take the server out of maintenance modeSet-ServerComponentState SRV-RU-EX0 -Component ServerWideOffline -State Active -Requester Maintenance Unpause the DAG node.Resume-ClusterNode SRV-RU-EX0 Set the server to allow database copy activationSet-MailboxServer SRV-RU-EX0 -DatabaseCopyActivationDisabledAndMoveNow $False 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 UnrestrictedSet-MailboxServer SRV-RU-EX0 -DatabaseCopyAutoActivationPolicy Unrestricted Set the hub transport component back to active to allow it to accept connections.Set-ServerComponentState SRV-RU-EX0 -Component HubTransport -State Active -Requester Maintenance Again, MS recommends that the transport services be restarted to help this change get picked up immediately.Restart-Service MSExchangeTransport Restart-Service MSExchangeFrontEndTransport