There are two ways of updating the DAG member servers as below; and documenting both the procedures for easy understanding
Method I: Using the built-in scripts provided by Microsoft
Placing the server in Maintenance mode for Windows Patches updating
-
Browse to the Exchange scripts folder on the DAG member server
D:\Program Files\Microsoft\Exchange Server\V15\Scripts
-
.\StartDagServerMaintenance.ps1 –serverName <Server name>
The script will automatically do the following:
-
Calls Suspend-MailboxDatabaseCopy on the database copies.
-
Pauses the node in Failover Clustering, so that it cannot become the Primary Active Manager.
-
Suspends database activation in each mailbox database.
-
Set the DatabaseCopyAutoActivationPolicy to Blocked on the server.
-
Moves databases and cluster group off of the designated server.
Returning an Exchange DAG Member to Production after the completion of windows patch update:
-
Browse to the Exchange scripts folder on the DAG member server
D:\Program Files\Microsoft\Exchange Server\V15\Scripts
- .\StopDagServerMaintenance.ps1 –serverName <Server name>
The script will automatically reverse each of the actions made by StartDagServerMaintenance.ps1
except that it will not move active mailbox databases back to the server.
Method II: Manually updating the servers as per the procedure stated:
-
Get the Active databases
list on the server using Get-Mailboxdatabase
-
Move Active mailbox databases to another DAG member so that the server can be updated.
Move-Activemailboxdatabase <database name> -ActivateonServer <server name>
-
Block activation on the server to prevent the server from auto re-activating a database copy while performing maintenance
Get-MailboxServer <servername> | fl Name,DatabaseCopyAutoActivationPolicy
Set-MailboxServer <servername> -DatabaseCopyAutoActivationPolicy Blocked
Returning an Exchange DAG Member to Production after the completion of Windows patch updates:
If the update was successful and the server found to be healthy then it can be placed back into production.
-
Set the server’s activation policy back to its original setting:
Set-MailboxServer <servername> -DatabaseCopyAutoActivationPolicy Unrestricted
At this stage move all of the active mailbox databases to the server that was just updated so that we can update the other servers in the DAG. After all of the DAG members have been updated it is likely that mailbox databases will be active on servers that are not their first activation preference.
Use the below scripts to verify the information about distribution of databases across the DAG member servers. We need to make sure databases are re-balanced across all the servers according to the activation preference.
[PS] D:\Program Files\Microsoft\Exchange Server\V15\Scripts>.\RedistributeActiveDatabases.ps1 -DagName <DAG Name> -ShowDatabaseDistributionByServer | Select Servername, totaldbs, activedbs, passivedbs, preferencecountlist, mounteddbs, dismounteddbs,dagname | sort servername | ft –AutoSize
Rebalance Mailbox Databases in a DAG
-
Browse to the Exchange scripts folder on the DAG member server
D:\Program Files\Microsoft\Exchange Server\V15\Scripts
-
.\RedistributeActiveDatabases.ps1 -DagName <DAGNAME> -BalanceDbsByActivationPreference –Confirm:$False
Get-MailboxDatabase | select name,server,activationpreference | sort name | ft -AutoSize