以下例子来自官方网站,适用于不同的创建DAG的场景

The following example creates a DAG named DAG1, which is configured to use the witness server FILESRV1 and the local directory C:\DAG1. DAG1 is also configured to use DHCP for the DAG's IP addresses.

New-DatabaseAvailabilityGroup -Name DAG1 -WitnessServer FILESRV1 -WitnessDirectory C:\DAG1

The next example creates a DAG named DAG2. For the DAG's witness server, the system automatically selects an Exchange 2016 server with Client Access services that is in the local Active Directory site. DAG2 is assigned a single static IP address because in this example all DAG members have the MAPI network on the same subnet.

New-DatabaseAvailabilityGroup -Name DAG2 -DatabaseAvailabilityGroupIPAddresses 10.0.0.8

This example creates the DAG DAG3. DAG3 is configured to use the witness server MBX2 and the local directory C:\DAG3. DAG3 is assigned multiple static IP addresses because its DAG members are on different subnets on the MAPI network.

New-DatabaseAvailabilityGroup -Name DAG3 -WitnessServer MBX2 -WitnessDirectory C:\DAG3 -DatabaseAvailabilityGroupIPAddresses 10.0.0.8,192.168.0.8

This example creates the DAG DAG4 that's configured to use DHCP. In addition, the witness server will be automatically selected by the system, and the default witness directory will be created.

New-DatabaseAvailabilityGroup -Name DAG4

This example creates the DAG DAG5 that will not have an administrative access point (valid for Windows Server 2012 R2 DAGs only). In addition, MBX4 will be used as the witness server for the DAG, and the default witness directory will be created.

New-DatabaseAvailabilityGroup -Name DAG5 -DatabaseAvailabilityGroupIPAddresses ([System.Net.IPAddress]::None) -WitnessServer MBX4

查询DAG组是否创建成功

Get-DatabaseAvailabilityGroup  | Format-List

获取更多IT资讯,您也可以关注下方的微信公众号:
Exchange Server 2016管理系列课件46.DAG管理之Powershell创建DAG_第1张图片
曾垂鑫的网络课堂,曾垂鑫大讲堂 - 51CTO学院

http://edu.51cto.com/lecturer/639838.html