This KB will show you how to put Exchange Server 2013 In maintenance mode using the build in Exchange scripts.
The entire process Is done from the Exchange Shell.
To start open EMS and go to:
C:\programs files\micrsoft\exchange server\v15\scripts
In the first step we put the first Exchange server In the DAG Into maintenance mode by typing the cmdlet below:
StartDagServerMaintenance.ps1 –servername dc2
Once run all DBs will move to the second Exchange server
To verify that the server is In maintenance mode type:
Get-databaseavailabilitygroup –status | fl name, server*
When you finish the maintenance work take the server out of maintenance mode by typing the following command:
stopDagServerMaintenance.ps1 –servername dc2
To redistribute the databases to mailbox server type:
.\RedistributeActiveDatabases.ps1 –DagName DAG1 –BalanceDBsByActivationPreference –Confirm:$false