Posted in
Exchange Server,
Windows Powershell |
No Comment | 40,173 views | 30/06/2011 23:58
You can get DAG configuration with this script.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| $DAGMemberServersArray = New-Object System.Collections.ArrayList
If ($Selected.Count -eq "0")
{
Write-Host "You didn't choose any DAG configuration."
Write-Host " "
Write-Host " "
Read-Host "Press enter to go back"
}
else
{
foreach ($DAGConfMember in $Selected)
{
$DAGInfo = (Get-DatabaseAvailabilityGroup $DAGConfMember)
$DAGName = $DAGInfo.Name
$DAGWitnessServer = $DAGInfo.WitnessServer.fqdn
$DAGWitnessDirectory = $DAGInfo.WitnessDirectory.PathName
$DAGIPAddress = $DAGInfo.DatabaseAvailabilityGroupIpv4Addresses
Write-Host "DAG Name: $DAGName" -ForegroundColor Green
Write-Host "DAG Witness Server: $DAGWitnessServer" -ForegroundColor Green
Write-Host "DAG Witness Directory: $DAGWitnessDirectory" -ForegroundColor Green
Write-Host "DAG IP: $DAGIpAddress" -ForegroundColor Green
$DAGMemberServers = (Get-DatabaseAvailabilityGroup $DAGConfMember).Servers
Foreach ($DAGMemberServer in $DAGMemberServers)
{
$DAGMemberServersArray.Add("$DAGMemberServer") | Out-Null
}
Write-Host "Server Members: $DAGMemberServersArray" -ForegroundColor Green
Write-Host " "
Write-Host " "
$DAGMemberServersArray.Clear();
}
Read-Host "Press enter to go back"
$Selected.Clear();
} |
$DAGMemberServersArray = New-Object System.Collections.ArrayList
If ($Selected.Count -eq "0")
{
Write-Host "You didn't choose any DAG configuration."
Write-Host " "
Write-Host " "
Read-Host "Press enter to go back"
}
else
{
foreach ($DAGConfMember in $Selected)
{
$DAGInfo = (Get-DatabaseAvailabilityGroup $DAGConfMember)
$DAGName = $DAGInfo.Name
$DAGWitnessServer = $DAGInfo.WitnessServer.fqdn
$DAGWitnessDirectory = $DAGInfo.WitnessDirectory.PathName
$DAGIPAddress = $DAGInfo.DatabaseAvailabilityGroupIpv4Addresses
Write-Host "DAG Name: $DAGName" -ForegroundColor Green
Write-Host "DAG Witness Server: $DAGWitnessServer" -ForegroundColor Green
Write-Host "DAG Witness Directory: $DAGWitnessDirectory" -ForegroundColor Green
Write-Host "DAG IP: $DAGIpAddress" -ForegroundColor Green
$DAGMemberServers = (Get-DatabaseAvailabilityGroup $DAGConfMember).Servers
Foreach ($DAGMemberServer in $DAGMemberServers)
{
$DAGMemberServersArray.Add("$DAGMemberServer") | Out-Null
}
Write-Host "Server Members: $DAGMemberServersArray" -ForegroundColor Green
Write-Host " "
Write-Host " "
$DAGMemberServersArray.Clear();
}
Read-Host "Press enter to go back"
$Selected.Clear();
}
$Selected is an array of Mailbox Servers.