Creating a DAG in Exchange 2010 SP1 multi-tenant mode
After my posts about Exchange multi-tenant or hosting mode I got a lot of questions about how to create Database Availability Group, or DAG, when running Exchange hosted. So I decided to dedicate a post on how to configure/create DAG using powershell.
Technically the below applies to any exchange setup but, since when running in hosting mode there is no more Exchange Management Console, it might be specially useful if you are trying to configure a DAG while running exchange in multi-tenant mode.
The setup
For this article I am using 2 Exchange 2010 SP1 servers running the mailbox role in multi-tenant mode configured as below
| Name | LAN IP | Replication network IP |
| VSMBX1 | 10.2.1.71 | 192.168.99.71 |
| VSMBX2 | 10.2.1.72 | 192.168.99.72 |
Creating the DAG
I will start by creating the DAG using the New-DatabaseAvailabilityGroup cmdlet. The command below will create a DAG named: DDCDAG01 with an IP address of 10.2.1.70 and use the server VSSHAREWIT as the share-witness.
New-DatabaseAvailabilityGroup -Name DDCDAG01 -WitnessServer VSSHAREWIT -WitnessDirectory C:\DDCDAG01Witness -DatabaseAvailabilityGroupIPAddresses 10.2.1.70
N.B.: If you get the warning "The Exchange Trusted Subsystem is not a member of the local Administrators group" however you did add the Exchange Trusted Subsystem group to the local Administrators group of your share witness to be, you can safely ignore this warning.
Adding the mailbox servers
After creating the Database Availability Group, it is now time to add the members to it. The below powershell commands will add Mailbox Servers VSMBX1 and VSMBX2 to the newly created DAG DDCDAG01
Add-DatabaseAvailabilityGroupServer DDCDAG01 -MailboxServer VSMBX1
Add-DatabaseAvailabilityGroupServer DDCDAG01 -MailboxServer VSMBX2
Managing DAG Networks
Another useful thing to learn is how to manage the DAG networks using powershell, running the powershell command Get-DatabaseAvailabilityGroupNetwork will return the automatically configured DAG networks
I decided to change the DAG networks to something more intuitive, so instead of DAGNetwork01 and DAGNetwork02 I renamed them MAPI and Replication using the Set-DatabaseAvailabilityGroupNetwork cmdlet. The full commands and their results are shown below
Adding Mailbox Database Copies
The final step in your DAG setup is to create copies of your mailbox databases on the other server. First a Get-MailboxDatabase will return the names of all mailbox databases that exists and where they are mounted.
Database copies can be added by using Add-MailboxDatabaseCopy, for example
Add-MailboxDatabaseCopy "Mailbox Database 0417769289" -MailboxServer VSMBX2
Will add a copy of the "Mailbox Database 0417769289" database to the VSMBX2 server
Finally a Get-MailboxDatabaseCopyStatus will show the status of the just replicated databases
That's it, you are now ready to create your first DAG fully using powershell and without the help of the GUI
Enjoyed the post, what is next?
Grab our FULL RSS feed! or Email Updates then share it

