If you find yourself needing the requirement of failing over databases between your Exchange DAG Availability Zones, we have a script you can use for this.

These will need to be run through the Exchange Management Shell with Administrator Privileges.

In this post i will just be using Availability Zones A + B, this can be scaled across multiple Zones.

 

Script to move Zone A to Zone B

Move-ActiveMailboxDatabase DB-XX -ActivateOnServer SERVERXX –Confirm:$False
Move-ActiveMailboxDatabase DB-XX -ActivateOnServer SERVERXX –Confirm:$False
Move-ActiveMailboxDatabase DB-XX -ActivateOnServer SERVERXX –Confirm:$False
Move-ActiveMailboxDatabase DB-XX -ActivateOnServer SERVERXX –Confirm:$False

Here you will need to reference the DB’s that are active in the DAG Availability Zone A, referencing the servers that the DB’s will need to be become active on in Zone B. The ‘–Confirm:$False’ represses the confirmation prompt for failing over individual databases, this will aid if the script is moving multiple DB’s.

You can then use the same format to move the DB’s from Zone B to Zone A.

 

Script to Move all Primary Databases back to preferred Server

RedistributeActiveDatabases.ps1 –DagName DAGNAMEXX – BalanceDbsByActivationPreference –Confirm:$False

This script is held in ExchangeServerScriptsRedistributeActiveDatabases.ps1

This script allows you to push all DB’s across the DAG back to their primary Activation Preference Server.

 

Thank you

About the author