DZone
Database Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Database Zone > How To Put Exchange Server in Maintenance Mode

How To Put Exchange Server in Maintenance Mode

Explore Exchange Maintenance Mode, its importance, the steps to put the Exchange Server into maintenance mode, and the steps to disable maintenance mode.

Shelly Bhardwaj user avatar by
Shelly Bhardwaj
·
May. 09, 22 · Database Zone · Tutorial
Like (2)
Save
Tweet
2.09K Views

Join the DZone community and get the full member experience.

Join For Free

Administrators must put the Exchange Server in maintenance mode while updating and making changes to the server to avoid data loss or other issues. If the changes or any security/cumulative updates are applied to the server without putting the server into maintenance mode, it can lead to database corruption or server failure.

In this article, we discuss the Exchange Maintenance Mode, its importance, and the steps to put the Exchange Server into maintenance mode. We also mention steps to disable maintenance mode once the server update or upgrade is completed.

What Is Exchange Server Maintenance Mode and Why Is It Important?

Exchange Maintenance Mode is the server state where all the server activities are suspended temporarily. All the Exchange services and components are put into the drain or inactive state. The mode is usually enabled when administrators need to apply Security Updates (SUs) or Cumulative Updates (CUs).

Although many admins do not follow this practice and patch their servers without putting them in maintenance mode, sometimes, the updates go through without breaking anything. However, it is not recommended.

You must enable Exchange Server maintenance mode, especially in the Database Availability Group (DAG) environment. If you start patching the server or upgrade CU without putting it in maintenance mode, the DAG may take over and break the server.

Steps To Enable or Put Exchange Server in Maintenance Mode

You can put the Exchange Server in maintenance mode using the PowerShell commands in Exchange Management Shell (EMS).

The steps are as follows:

1. Set HubTransport Service To Drain State

HubTransport service is responsible for the mail flow in your organization and applying transport rules. Thus, it’s important to put the HubTransport to the draining state before placing the server into maintenance mode.

To set HubTransport to drain or inactive state, execute the following PowerShell command in the Exchange Management Shell (EMS).

Set-ServerComponentState -Identity "YourServerName" -Component HubTransport -State Draining -Requester Maintenance

Change YourServerName with the server name.

Change YourServerName with the server name

2. Suspend Cluster Node

If the server is a part of the Database Availability Group, suspend the cluster node using the following command. Otherwise, you can put the server in maintenance mode.

Suspend-ClusterNode "YourServerName-01"

3. Disable Database Copy Auto-Activation

Set-MailboxServer "YourServerName-01" -DatabaseCopyActivationDisabledAndMoveNow $true Set-MailboxServer "YourServerName-01" -DatabaseCopyAutoActivationPolicy Blocked
Disable Database Copy Auto-Activation

4. Put Server in Maintenance Mode

Run the following command in EMS to put your Exchange Server in maintenance mode.

Set-ServerComponentState "YourServerName" -Component ServerWideOffline -State Inactive -Requester Maintenance 

5. Verify the Server Is in Maintenance Mode

To check if the server is successfully switched to maintenance mode, run the following command in the EMS.

Get-ServerComponentState -Identity "YourServerName”

Verify the server is in maintenance mode

You can download and apply the required Security Update or Cumulative Update on your Exchange Server at this stage. Make sure to apply updates through the elevated Command Prompt window.

Note: If you use any load balancer, make sure to redirect it to the other active node or server.

Steps to Turn Off Exchange Server Maintenance Mode

Once the update or upgrade is finished, it’s important to disable the Exchange Server maintenance mode and start the Exchange Services. If you don’t do this, your server will remain inaccessible and users will have a hard time accessing their email accounts or mail items.

The steps are as follows:

1. Resume Cluster Node

To resume the DAG Cluster node, run the following command in EMS.

Resume-ClusterNode "YourServerName-01"

2. Enable Database Copy Auto-Activation

To enable database copy auto-activation, run the following commands:

Set-MailboxServer YourServerName –DatabaseCopyAutoActivationPolicy Unrestricted 

Set-MailboxServer YourServerName –DatabaseCopyActivationDisabledAndMoveNow $false

3. Turn Off Maintenance Mode

To turn off maintenance mode and enable Exchange services, run the following command in EMS.

Set-ServerComponentState "YourServerName" -Component ServerWideOffline -State Active -Requester Maintenance

4. Set HubTransport Service To Active State

For this, execute the following command:

Set-ServerComponentState "YourServerName" –Component HubTransport –State Active –Requester MaintenanceSet HubTransportService to active state

5. Verify the Server Is Out of Maintenance Mode

Get-ServerComponentState -Identity "YourServerName”
Verify the server is out of maintenance mode

Also, check the cluster node and ensure all services are running by using the following commands in the EMS.

Get-ClusterNode "YourServerName" 

Get-ClusterNode  

Test-ServiceHealth "YourServerName"
Test- Service Health "YourServerName"

Get-ExchangeServer | Test-ServiceHealth

Get-ExchangeServer | Test-ServiceHealth

Conclusion

Exchange Server updates are critical to safeguarding servers from malicious attacks and threat actors. But before you begin applying the Exchange Server Security or Cumulative Updates, put your server in maintenance mode. Follow this article to learn how to put an Exchange Server in maintenance mode. This is a critical step to avoid server failure or database corruption that can lead to disruption, impact productivity, and financial losses.

Database Command (computing)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Maven Tutorial: Nice and Easy [Video]
  • Memory Debugging and Watch Annotations
  • How to Optimize MySQL Queries for Speed and Performance
  • A Simple Guide to Heaps, Stacks, References, and Values in JavaScript

Comments

Database Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo