Posted in
Exchange Server,
Windows Powershell |
No Comment | 4,763 views | 30/06/2011 23:54
This script checks all available hub transport servers for DAG membership.
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
| $AvailableHTServer = @(Get-ExchangeServer | where {$_.ServerRole -like "*HubTransport*" -and $_.ServerRole -notlike "*Mailbox*"})
$AvailableHTServerCount = $AvailableHTServer.Count
$DAGName = Read-Host "Enter a name for your DAG"
Write-Host " "
if ($AvailableHTServerCount -gt "0")
{
$AvailableHTServerName = $AvailableHTServer[0].Name
Write-Host "Would you like to use $AvailableHTServerName as a witness server?"
Write-Host "1) Yes"
Write-Host "2) No"
Write-Host " "
[int]$HTQuestion = Read-Host "Enter number to select an option"
Write-Host " "
if ($HTQuestion -eq "1")
{
$WitnessServer = $AvailableHTServerName
}
else
{
$WitnessServer = Read-Host "Enter witness server name (like $AvailableHTServerName)"
}
}
else
{
Write-Warning "There are no suitable Hub Transport servers as a witness server."
Write-Warning "You should enter a witness server which has no Mailbox role on it."
Write-Warning "Make sure that the group Exchange Trusted Subsystem is added to the local administrators of the server that will be the witness server."
Write-Host " "
$WitnessServer = Read-Host "Enter witness server name"
} |
$AvailableHTServer = @(Get-ExchangeServer | where {$_.ServerRole -like "*HubTransport*" -and $_.ServerRole -notlike "*Mailbox*"})
$AvailableHTServerCount = $AvailableHTServer.Count
$DAGName = Read-Host "Enter a name for your DAG"
Write-Host " "
if ($AvailableHTServerCount -gt "0")
{
$AvailableHTServerName = $AvailableHTServer[0].Name
Write-Host "Would you like to use $AvailableHTServerName as a witness server?"
Write-Host "1) Yes"
Write-Host "2) No"
Write-Host " "
[int]$HTQuestion = Read-Host "Enter number to select an option"
Write-Host " "
if ($HTQuestion -eq "1")
{
$WitnessServer = $AvailableHTServerName
}
else
{
$WitnessServer = Read-Host "Enter witness server name (like $AvailableHTServerName)"
}
}
else
{
Write-Warning "There are no suitable Hub Transport servers as a witness server."
Write-Warning "You should enter a witness server which has no Mailbox role on it."
Write-Warning "Make sure that the group Exchange Trusted Subsystem is added to the local administrators of the server that will be the witness server."
Write-Host " "
$WitnessServer = Read-Host "Enter witness server name"
}
You can use $WitnessServer for provisioning.