Backtrack:  
 
by lunarg on August 14th 2015, at 14:22

Every once in a while you will have to perform maintenance (e.g. installing updates, troubleshooting, hardware maintenance) on your Exchange 2013 servers. In the past, you had to schedule proper downtime and do manual changes to configurations for this to work properly. Exchange 2013 SP1 introduced "Maintenance mode", allowing your Exchange 2013 servers to be put in maintenance mode. This allows you to perform maintenance on a server without the end users noticing it's gone, or without having to schedule downtime.

Maintenance mode was designed for mailbox servers (i.e. servers that have the mailbox role, either standalone or multi-role). However, it's worth noting that putting a server into maintenance mode does not affect CAS components: clients will still be able to access services such as OWA, EWS, ... E.g. in case of a load balancer, you need to exclude the server in maintenance so clients do not connect to the wrong server.

Note for DAG members (Database Availability Group)

Maintenance mode can be activated regardless of the presence of DAG, although there are some extra steps involved for DAG members, as we need to prevent automatic failover and make the remaining DAG members the active server for the databases.

Required access

You need an account that has Organization Management access, and have access to the Exchange Management Shell.

Enabling maintenance mode

Log on to any Exchange server using EMS, then follow the steps below, replacing parameters as needed.

  1. Drain all activate mail queues on the server:
    Set-ServerComponentState <ServerName> -Component HubTransport -State Draining -Requester Maintenance
  2. By default, it takes a while for the transport services to pick up the state change. You can restart the service(s) to speed things up:
    Restart-Service MSExchangeTransport
    If the server is also a CAS, restart the front-end transport as well:
    Restart-Service MSExchangeFrontEndTransport
  3. Redirect pending messages in the local queue to another mailbox server:
    Redirect-Message -Server <ServerName> -Target <OtherMailboxServerFQDN>
    Obviously, the target mailbox server cannot be in maintenance mode. Also, you have to specify the server by its FQDN.
  4. For DAG members!
    1. To prevent the server from being and becoming the PAM, pause the cluster node:
      Suspend-ClusterNode <ServerName>
    2. Move all active databases from the server to other DAG members:
      Set-MailboxServer <ServerName> -DatabaseCopyActivationDisabledAndMoveNow $True
      This may take a few moments so be patient.
    3. Get the current database copy auto activation policy and write it down. You need to change it back to this value once you bring the server out of maintenance mode:
      Get-MailboxServer <ServerName> | Select DatabaseCopyAutoActivationPolicy
    4. Now change the auto activation policy to blocked to prevent the DAG member from running any active database copies:
      Set-MailboxServer <ServerName> -DatabaseCopyAutoActivationPolicy Blocked
  5. And finally, put the server into maintenance mode:
    Set-ServerComponentState <ServerName> -Component ServerWideOffline -State Inactive -Requester Maintenance

Verify whether the server is in maintenance mode

You can verify whether the server is in maintenance mode by running this in the EMS:

Get-ServerComponentState <ServerName> | FT Component,State –Autosize

All components should be "Inactive", except for Monitoring and RecoveryActionsEnabled.

Disabling maintenance mode

Log on to any Exchange server using EMS, then follow the steps below, replacing parameters as needed.

  1. Put the server out of maintenance mode:
    Set-ServerComponentState <ServerName> -Component ServerWideOffline -State Active -Requester Maintenance
  2. For DAG members!
    1. Resume the cluster node:
      Resume-ClusterNode <ServerName>
    2. Allow the DAG member to host active mailbox copies again:
      Set-MailboxServer <ServerName> -DatabaseCopyActivationDisabledAndMoveNow $False
    3. Set the auto activation policy back to its original value. If the original value was already set to Blocked, you can skip this step. If it was something else, run:
      Set-MailboxServer <ServerName> -DatabaseCopyAutoActivationPolicy Unrestricted
  3. Re-enable the hub transport to allow mail from being queued again:
    Set-ServerComponentState <ServerName> -Component HubTransport -State Active -Requester Maintenance
  4. Optionally, you can restart the transport services so they pick up the state changes more quickly:
    Restart-Service MSExchangeTransport
    If the server is also a CAS, restart the front-end transport as well:
    Restart-Service MSExchangeFrontEndTransport

Verify whether the server is out of maintenance mode

You can verify whether the server is out of maintenance mode by running this in the EMS:

Get-ServerComponentState <ServerName> | FT Component,State –Autosize

All components should be "Active".

 
 
« November 2024»
SunMonTueWedThuFriSat
     12
3456789
10111213141516
17181920212223
24252627282930
 
Links
 
Quote
« When a bird does poo poo in your eye, be happy elephants don't fly. »