Check and re-balance Exchange DAG

It you did some maintenance in your Exchange DAG you must move mailbox databses to other server. After exit the maintenance you should check if some databases are running active on the „wrong“ server.

You can also wait until the PreferenceMoveFrequency is over and the cluster do this by itself. You can check the PreferenceMoveFrequency with this simple Powershell command:

Get-DatabaseAvailabilityGroup | Format-Table Name, Preference*

But if needed the following script checks whether the current Exchange DAG server is running databases for which it is NOT the preferred Active Server, or whether it is itself missing databases for which it is the preferred Active Server.

For each database found, a separate query is performed to determine whether it should be switched back.
Only one output is generated for databases that are correct. For visual verification, the output is color-coded in red and green.

https://github.com/tsukaito-code/Powershell/blob/main/Exchange%20On-Premises/Check-DAG-Database-Master.ps1

If you find some „incorrect“ database owner than you can re-balance the DAG with this script.

https://github.com/tsukaito-code/Powershell/blob/main/Exchange%20On-Premises/Run-DAG-Database-Rebalance.ps1

Schreibe einen Kommentar