Exchange Server & Hosting your environment, Database Availability Group (DAG)) and if an update or maintenance operation is to be performed on the server, these operations Maintenance Mode We need to perform it under.
Typically, this is done through the Exchange Management Shell. However, Exchange Server It comes with two PowerShell scripts to easily manage these operations:
Exchange Server Maintenance Mode Structure
Exchange ServerTwo basic PowerShell scripts used to manage maintenance operations in , Maintenance Mode These scripts are especially useful for Database Availability Group (DAG)) is important for structured systems.
StartDagServerMaintenance.ps1
This script is located on Exchange Server, DAY the active database server in Primary Active Manager (PAM) It is used to temporarily transfer the role to another server. After the script ensures that the active database role is safely moved, it prevents the databases from being migrated to other servers until your maintenance operation is completed.
This ensures that data integrity is maintained and continuity is ensured during Exchange Server maintenance.
- Exchange Server Active Manager You can use the links below for articles related to .
StopDagServerMaintenance.ps1
StartDagServerMaintenance.ps1 This script, which is complementary to the script, performs the reverse of the maintenance mode operations that are initiated. When the Maintenance operations are completed on the Exchange Server, the roles and functions of the database server are restored using this script. Thus, the database servers in the DAG can continue their normal operations. StopDagServerMaintenance.ps1 minimizes the downtime by allowing the system to quickly return to normal workflow.
Both scripts are designed to facilitate Exchange Server management and to carry out maintenance processes smoothly.
How to Get Exchange Server Maintenance Mode?
The scripts we will use to activate Exchange Server Maintenance Mode are located under the installation directory and you can access the relevant directory with the following command via EMS (Exchange Management Shell).
You can use these scripts not only during maintenance operations but also when testing your DAG environment. This way, you can check whether your databases in the DAG are working properly.
For example, I have two servers named EXC01-DAG and EXC02-DAG. I need to perform a planned maintenance on the EXC01-DAG server and for this process I will put the server in Maintenance Mode. I go to the directory where the script is located with the following command on the relevant server:
cd $Exscripts
The command to put the server into maintenance mode is as follows:
.StartDagServerMaintenance.ps1 -ServerName EXC01-DAG -OverrideMinimumTwoCopies
Once maintenance is completed on server EXC01, you can use the StopDagServerMaintenance script to take the server out of maintenance mode:
.StopDagServerMaintenance.ps1 -ServerName EXC01-DAG
What is the Exchange Server OverrideMinimumTwoCopies Parameter?
When using the StartDagServerMaintenance script, in addition to the “-ServerName” parameter, we also used the “-OverrideMinimumTwoCopies” parameter. This parameter ensures that the script checks for at least two available copies by default before moving a database to another server. Since there are only two nodes during maintenance, you will have only one active copy while one of them is being maintained. In this case, the “-OverrideMinimumTwoCopies” parameter is mandatory. If you have three or more database copies, you do not need to use this parameter.