How to put Exchange Server in Maintenance Mode?

Configurare noua (How To)

Situatie

You must put the Exchange Server in maintenance mode when installing monthly Windows Security and features updates, Exchange Server Cumulative Updates (CU), or any other software updates, and doing hardware upgrades or replacement. Otherwise, it would lead to corruption in the database or even failure of the server. Below, we’ll be discussing the stepwise process to put an Exchange Server in maintenance mode.

Steps to put Exchange Server in Maintenance Mode

To put a server in maintenance mode, you need to use PowerShell commands in Exchange Management Shell (EMS) from another Exchange Server in your Exchange Database Availability Group (DAG).

Let’s start off with the process.

Solutie

Pasi de urmat

Drain the Message Queues

The first step is to drain the message queues. For this, you need to use the Set-ServerComponentState PowerShell command, as given below.

Set-ServerComponentState -Identity “servername to put in maintenance mode” -Component HubTransport -State Draining -Requester Maintenance

Set-ServerComponentState

This will put the server in maintenance mode to drain all the messages. Next, you need to redirect any queued messages to another server by using the below command.

Redirect-Message -Server “server name in maintenance” -Target “server name to redirect to”

Redirect-Message

The above command will redirect all the queued messages to the new host.

Suspend the Server from Cluster

The next step is to pause or suspend the server in the cluster and Database Availability Group (DAG) to reduce the risk of issues from the cluster service. To suspend the server from cluster, you need to suspend the node in the cluster. To do this, use the Suspend-ClusterNode PowerShell command as given below.

Suspend-ClusterNode “server name in maintenance mode”

Suspend-ClusterNode

Move any Active Copies from the Server

A secondary server can still host an active database copy. So, you need to move it to another server. This can be done by using the Set-MailboxServer command as given below.

Set-MailboxServer “server name in maintenance mode” -DatabaseCopyActivationDisabledAndMoveNow $true

Set-MailboxServer

This may take some time to complete as it is not an instance change.

Set the Activation Policy

You need to also make a note of the Activation Policy on the server to make sure that the value is retained after the exit from the maintenance mode. Use the following command to get the Activation Policy.

Get-MailboxServer “server name in maintenance mode” | Select DatabaseCopyAutoActivationPolicy

Select DatabaseCopyAutoActivationPolicy

Now, you need to make sure that the Activation Policy is set to blocked. This ensures that no database will come online on the target server while doing the maintenance.

Set-MailboxServer “server name in maintenance mode” -DatabaseCopyAutoActivationPolicy Blocked

DatabaseCopyAutoActivationPolicy Blocked

Verification

You need to confirm that there are no active databases on the server. For this, run the following command.

Get-MailboxDatabaseCopyStatus -Server “server name in maintenance mode” | Where {$_.Status -eq “Mounted”} | ft -AutoSize

Get-MailboxDatabaseCopyStatus

You need to also ensure that there are no emails in the queue of the server. If there is any queue, it should show zero in the message count.

For this, you need to run the Get-Queue command from the target server.

Get-Queue

Put the Server in Maintenance Mode

To put the server in maintenance mode, you need to use the Set-ServerComponentState command as given below. Set-ServerComponentState “server name in maintenance mode” -Component ServerWideOffline -State Inactive -Requester Maintenance

Set-ServerComponentState

To verify that the server is inactive and is in the maintenance mode, you need to use the same command (as given below) and confirm that all the services, except Monitoring and RecoveryActionEnabled, are inactive.

Get-ServerComponentState “server name in maintenance mode” | Select Component, State

Get-ServerComponentState

It is recommended that after the above process, restart the server. This will free up any running processes and clear any pending updates which were started.

Tip solutie

Permanent

Voteaza

(3 din 8 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?