Exchange 2016 Create DAG using Powershell

In this tutorial I will walk you through the installation of an Exchange Server 2016 database availability group. For this example a DAG with two members in the same site is being created, with a third Windows server in the same site being used as the file share witness.

To prepare for the new database availability group I’ve installed two Exchange 2016 servers with identical hardware, storage and performance specifications. When each server was installed, Exchange setup created a default mailbox database. I’ve already renamed the databases to unique names, and moved them to storage paths ready to replicate between the two DAG members.

[PS] C:\>Get-MailboxDatabase | fl name,edbfilepath,logfolderpath

Name          : DB05

EdbFilePath   : E:\DB05\DB05.edb

LogFolderPath : F:\DB05

Name          : DB06

EdbFilePath   : E:\DB06\DB06.edb

LogFolderPath : F:\DB06

I have also prepared the file share witness server by adding the Exchange Trusted Subsystem group to the local Administrators group of the server.

In this example I’m creating a database availability group with no cluster administrative access point (CAAP). The DAG has no IP address of its own, and no computer object in Active Directory. The main implication of this is that backup software that relies on the CAAP for backup operations won’t work. As this option of an IP-less DAG was first introduced in Exchange Server 2013 SP1/CU4, so by now any decent backup product should support this configuration. But you should always verify this with your backup vendor of choice. Also be aware that this is only supported for DAGs that are running on Windows Server 2012 R2 (or later).

To create the new DAG from the Exchange Management Shell we run New-DatabaseAvailabilityGroup, providing the name for the DAG and also specifying the name of the file share witness server. I’m also specifying the filesystem for the DAG because my Exchange 2016 servers are using ReFS for their data volumes.

[PS] C:\>New-DatabaseAvailabilityGroup -Name EX2016DAG01 -WitnessServer mgmt.exchangeserverpro.net -FileSystem ReFS

Name             Member Servers                                      Operational Servers

----             --------------                                      -------------------

EX2016DAG01      {}

The new DAG object has now been created, but it doesn’t have any members yet. Next we add our Exchange 2016 servers to the DAG.

[PS] C:\>Add-DatabaseAvailabilityGroupServer -Identity EX2016DAG01 -MailboxServer EX2016SRV1

Repeat the previous step for the other DAG members as well.

[PS] C:\>Add-DatabaseAvailabilityGroupServer -Identity EX2016DAG01 -MailboxServer EX2016SRV2

The DAG now has two members.

[PS] C:\>Get-DatabaseAvailabilityGroup EX2016DAG01 -Status

Name             Member Servers                                      Operational Servers

----             --------------                                      -------------------

EX2016DAG01      {EX2016SRV2, EX2016SRV1}                            {EX2016SRV1, EX2016SRV2}

The DAG’s file share witness is the server that was specified at the time of creation, MGMT, and the default witness directory has been configured by Exchange.

[PS] C:\>Get-DatabaseAvailabilityGroup EX2016DAG01 -Status | fl *witness*

WitnessServer             : mgmt.exchangeserverpro.net

WitnessDirectory          : C:\DAGFileShareWitnesses\EX2016DAG01.exchangeserverpro.net

AlternateWitnessServer    :

AlternateWitnessDirectory :

WitnessShareInUse         : Primary

On the witness server itself you can see the witness directory has been created and populated.

Now that the Exchange Server 2016 database availability group has been created we can proceed with adding database copies.