Exchange 2019 – Create a DAG using PowerShell
In Exchange, creating a DAG using the GUI is very easy, you fill in your DAG name, Witness Server and Witness Directory and optional to enter an IP address, let’s look at how to do this using Powershell in Exchange 2019.
Exchange should create the witness folder for you but in my Lab I only have a domain controller so will manually create it. You need to give the Exchange Trusted Subsystem rights to it and as this is a DC there is no local groups.
Now launch the Exchange Management Shell (EMS) and run the following command:
- New-DatabaseAvailabilityGroup -Name GroupName -WitnessServer “Server” -WitnessDirectory C:\EXDAG
Wait for a couple of seconds and it should create the DAG for you. Once done you can check the properties of the DAG as shown below and using the PowerShell command:
- Get-DatabaseAvailabilityGroup -Identity DAGName | fl
Next step is to add member servers to the newly created DAG you created, to do so you can run the following command:
- Add-DatabaseAvailabilityGroupServer -Identity DAGName -MailboxServer ServerName
This will install Windows Failover Clustering on your Exchange server/s. Can take a while.
Hope it helps.