Before performing Cumulative Updates (CU), Security Updates (SU), hardware upgrades, or any planned maintenance on a Microsoft Exchange Server, it is critical to properly place the server into Maintenance Mode. This ensures that mail flow is safely redirected, active database copies are moved to healthy DAG members, and no unexpected database activation occurs during maintenance.
In this guide, we will walk through each PowerShell command used in Exchange Server Maintenance Mode and explain what each command does and why it is required.
⚙️ Exchange Server Maintenance Mode Commands Explained
1. Drain Hub Transport Service
Set-ServerComponentState -Identity "MSFT-EXCH-AZ-BAKU-01" -Component HubTransport -State Draining -Requester Maintenance
What it does:
- Puts the Hub Transport component into a draining state.
- Stops accepting new email submissions.
- Allows existing messages in the transport pipeline to be processed.
Why it is used:
This prevents message loss or queue buildup by ensuring that Exchange gracefully stops receiving new mail while still processing existing mail flow.
2. Redirect Transport Messages
Redirect-Message -Server "MSFT-EXCH-AZ-BAKU-01" -Target "MSFT-EXCH-AZ-BAKU-02.MSFTADVOCATE.LOCAL"
What it does:
- Redirects queued messages on the source server to another Exchange server.
Why it is used:
Ensures that any pending messages in the transport queue are processed by another healthy server, avoiding mail delays during maintenance.
3. Suspend Cluster Node
Suspend-ClusterNode "MSFT-EXCH-AZ-BAKU-01"
What it does:
- Pauses the node in the Windows Failover Cluster.
- Prevents the cluster from placing new roles or workloads on this node.
Why it is used:
This ensures that the cluster does not automatically fail back or activate resources on the server being maintained.
4. Move Mailbox Databases and Disable Activation
Set-MailboxServer "MSFT-EXCH-AZ-BAKU-01" -DatabaseCopyActivationDisabledAndMoveNow $true
What it does:
- Moves active mailbox database copies to other DAG members.
- Prevents database activation on the server.
Why it is used:
Ensures that no active mailbox databases remain on the server during maintenance.
5. Check Database Auto Activation Policy
Get-MailboxServer "MSFT-EXCH-AZ-BAKU-01" | Select DatabaseCopyAutoActivationPolicy
What it does:
- Displays the current auto activation policy for mailbox database copies.
Why it is used:
Used to verify whether the server is allowed to automatically activate databases.
6. Block Database Activation
Set-MailboxServer "MSFT-EXCH-AZ-BAKU-01" -DatabaseCopyAutoActivationPolicy Blocked
What it does:
- Blocks automatic activation of mailbox database copies on the server.
Why it is used:
Prevents unexpected failover or database activation during maintenance activities.
7. Verify Mounted Databases
Get-MailboxDatabaseCopyStatus -Server "MSFT-EXCH-AZ-BAKU-01" | Where {$_.Status -eq "Mounted"} | ft -AutoSize
What it does:
- Lists all mailbox database copies that are still mounted on the server.
Why it is used:
Confirms that all active databases have been successfully moved to other DAG members before maintenance begins.
8. Check Mail Queues
Get-Queue
What it does:
- Displays the current Exchange transport queue status.
Why it is used:
Used to verify that no messages are stuck in the queue before shutting down transport services.
9. Put Exchange Server into Offline Mode
Set-ServerComponentState "MSFT-EXCH-AZ-BAKU-01" -Component ServerWideOffline -State Inactive -Requester Maintenance
What it does:
- Sets the entire Exchange server into offline maintenance state.
- Stops all Exchange components from serving client requests.
Why it is used:
Ensures the server is fully isolated from client traffic during maintenance operations.
10. Verify Maintenance Mode Status
Get-ServerComponentState "MSFT-EXCH-AZ-BAKU-01" | Select Component,State
What it does:
- Displays the current state of all Exchange server components.
Why it is used:
Final validation step to confirm that the server is correctly in Maintenance Mode.
✅ Conclusion
Properly placing an Exchange Server into Maintenance Mode is a critical procedure in DAG environments. It ensures zero data loss, continuous mail flow, and safe server maintenance without impacting end users.
Following these PowerShell steps guarantees that the server is safely drained, databases are moved, and all Exchange services are correctly taken offline before any maintenance operation begins.