Put Exchange Server in Maintenance Mode Using PowerShell
Like any other infrastructure, the Exchange Server also needs to be kept in the best possible condition to ensure that users don’t face any major issues. To do this, system admins put the Exchange Server in maintenance mode.
This state change is usually necessary to troubleshoot an issue, install new updates, and/or replace old hardware.
This works like a safety valve without which it would become a lot more difficult to carry out such intensive activity safely.
However, performing maintenance on the Exchange Database is no easy task as it involves multiple PowerShell cmdlets. Even the GUI path is not straightforward. Not to worry as we will help you get over all the difficulties through the instructions in this writeup.
Let us start with understanding what exactly this mode means for your Exchange Server
What Does it Mean to Put Exchange Server in Maintenance Mode?
Maintenance mode is a special status where the admin temporarily puts a pause on all regular activity that goes on inside an Exchange Server.
It is essentially a deep cleanup of the Digital infra often accompanied by a hardware upgrade or software patch. Or something specific like preventing the Exchange server from recreating meetings after a user role change.
It is also possible that maintenance might be done in emergency scenarios where there has been a security breach. Or when there is some problem with some specific features like the Exchange Search not working and you need to fix that.
As in maintenance mode, the server is essentially offline so it becomes a lot easier to isolate and fix the issue.
The most common way to conduct maintenance is via scripts so let’s see how it is done.
Steps to Put Exchange Server in Maintenance Mode with PowerShell
- Redirect Client Access to prevent them from disrupting the maintenance.
Set-MailboxServer -Identity "<Name>" -DatabaseCopyAutoActivationPolicy Block
- Stop Load Balancer Traffic
- Use your load balancer’s management console to disable or drain the server.
- Verify that no new connections are being sent to the server.
- If your server is part of a Database Availability Group (DAG), suspend it.
Suspend-ClusterNode -Name "<NodeName>"
- Then, use the following script, available in the Exchange installation directory, to place your server in maintenance mode:
cd $ExScripts ./StartDagServerMaintenance.ps1 -ServerName "<ServerName>"
- Perform Maintenance Tasks like hardware upgrades or new update installation, etc. Once maintenance is complete, bring the server back to normal operations using this PowerShell script:
cd $ExScripts ./StopDagServerMaintenance.ps1 -ServerName "<ServerName>"
- Resume the cluster node (in DAG configuration only) to rejoin normal DAG operations:
Resume-ClusterNode -Name "<NodeName>"
- Re-enable Load Balancer Traffic
Reintroduce the server to the load balancer’s rotation by enabling or un-draining traffic.
- Verify Server Health
Finally, check the server’s health to ensure all services are running correctly, for that type:
Test-ServiceHealth
Use it to verify if mailbox databases mount correctly and are accessible to users so they can connect without issues.
Use GUI to Put the Exchange Server in Maintenance Mode
You won’t find a toggle maintenance mode button anywhere in the EAC. Neither will Admins see an alert that their Server is already under maintenance. They have to manually do a series of changes on their server to replicate this setting.
First of all, redirect client access. This is to prevent users from disrupting the maintenance process. Ensure that information regarding this planned downtime is given to the end user beforehand.
- Log in to the Exchange Admin Center (EAC) (<your_server_ip>/ecp)
- Navigate to Servers > Databases.
- Manually dismount the mailbox database(s) hosted on the server you wish to maintain.
- Confirm the dismount action. This prevents users from accessing the databases hosted on that server.
If your organization uses a load balancer visit the load balancer’s management interface.
Then, disable or drain connections to the Exchange Server undergoing maintenance.
Keep in mind that you won’t be able to suspend DAG Node (DAG Environment) via GUI. So use PowerShell instead. However, you can still disable other minor server components via EAC to perform maintenance on them. For that.
- Go to Servers > Servers.
- Select the server and choose Edit.
- Disable specific components or move their workloads (e.g., disable transport or client access roles).
Best Practices for a Smooth Exchange Maintainance
Inform the user base beforehand (at least 1-2 hours before), so that this planned downtime does not come as a surprise.
Form a regular maintenance cycle for the Exchange Server, this can be monthly, quarterly, or annual depending on your organization’s requirements. Regardless of the time frame, it’s important that it happens and does not get delayed.
Use an automated recovery agent to repair corrupt/damaged edb files you find during maintenance instead of the long and complex manual recovery process.
For that, you can use the SysTools EDB Repair Tool, which provides all the necessary features in a single package.
Admins can install and deploy it with ease.
Conclusion
So now admins will be able to put the Exchange Server in maintenance mode without any issues.
Here we gave the readers a full list of PowerShell commands that ensure a safe state change and its reversal too.
Other than that we also included the steps to use the GUI components for those who prefer it.
Moreover, admins can make use of the professional Exchange repair tool to fix any major issues that appear on their server while in maintenance mode.