In your Exchange 2010 environment you will need to re-balance your DAG’s after you perform maintenance or if you had a failure on a Server of if you copies moved to another server.
You can manually move the databases from the Exchange Management Console but PowerShell comes to the rescue and does it for you by running one script.
Microsoft provide this script to you and it is located in the installation directory. You can find it here (if you left the default installation directory as is when you installed Exchange 2010:
- C:\Program Files\Microsoft\Exchange Server\V14\Scripts
(In Exchange 2013 the folder will be V15 and not V14 as shown above)
Take note that you can access the same script in Exchange 2013 as well. To begin, launch the Exchange Management Shell (EMS):
Next navigate to the script directory.
You can do so by typing in “Cd\” and pressing enter to take you to the root of C:\ and then start typing in cd program files and press tab and it will auto complete the name. Once you have the full path press enter so your EMS looks like the below:
The last step is to type in the command to redistribute your Exchange DAG:
- .\RedistributeActiveDatabases.PS1 – DagName <Name of Dag> -BalanceDbsByActivationPreference -Confirm:$All
Replace <Name of Dag> with your Exchange DAG name.
I included the -Confirm:$All switch in so it saves you having to press enter for each database that needs to be moved. In large environment this will save you time.
The script will start and it will list the servers in the DAG and the databases and after a few seconds will start moving them. You will get a green line of code saying it was successfully moved. If you get an error then review it before trying again.
Hope it helps.