asked on
[array]$DropDownArray1 = get-exchangeserver |? {$_.IsE14OrLater -eq $True} |% {$_.name}
function Return-DropDown {
$Node1 = $DropDown.SelectedItem
$Form.Close()
Write-Host -Fore "Green" "$Node1"
do {
#$Node1 = $DropDown.SelectedItem
#$Form.Close()
#Write-Host -Fore "Green" "$Node1"
$p = (get-exchangeserver -identity $Node1).admindisplayversion
Write-Host -Fore "Green" "$p"
$q = (get-exchangeserver -identity $Node1).IsMailboxServer
Write-Host -Fore "Green" "$q"
$x = (Get-MailboxServer -identity $Node1).DatabaseAvailabilityGroup
Write-Host -Fore "Green" "$x"
#
$a = (get-exchangeserver -identity $Node1).admindisplayversion
$b = (get-exchangeserver -identity $Node1).IsMailboxServer
$c = (Get-MailboxServer -identity $Node1).DatabaseAvailabilityGroup
#
if ($a -notmatch "14.1") {
Write-Host -Fore "Yellow" "$Node1 is not an Exchange 2010 Server"
$input = $true
Break
}
elseif ($b -ne $True) {
Write-Host -Fore "Yellow" "$Node1 does not have Exchange 2010 Mailbox Server Role installed"
$input = $True
Break
}
elseif ($c -ne $False) {
Write-Host -Fore "Yellow" "$Node1 is already part of DAG $x"
$input = $True
Break
}
else {
Write-Host -Fore "Green" "$Node1 is not part of DAG"
$input = $False
}
} While ($input)
}
#
[Void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[Void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
$Form = New-Object System.Windows.Forms.Form
$Form.width = 300
$Form.height = 150
$Form.Text = ”DropDown”
$DropDown = new-object System.Windows.Forms.ComboBox
$DropDown.Location = new-object System.Drawing.Size(100,10)
$DropDown.Size = new-object System.Drawing.Size(130,30)
#
#
ForEach ($ExSrv1 in $DropDownArray1) {
$DropDown.Items.Add($EXSrv1)
}
#
$Form.Controls.Add($DropDown)
$DropDownLabel = new-object System.Windows.Forms.Label
$DropDownLabel.Location = new-object System.Drawing.Size(10,10)
$DropDownLabel.size = new-object System.Drawing.Size(100,40)
$DropDownLabel.Text = "Exchange 2010 Server"
$Form.Controls.Add($DropDownLabel)
$Button = new-object System.Windows.Forms.Button
$Button.Location = new-object System.Drawing.Size(100,50)
$Button.Size = new-object System.Drawing.Size(100,30)
$Button.Text = "Select Server"
$Button.Add_Click({Return-DropDown})
$form.Controls.Add($Button)
$Form.Add_Shown({$Form.Activate()})
$Form.ShowDialog()
#
Write-Host -Fore "Green" "$Node1"
Exchange is the server side of a collaborative application product that is part of the Microsoft Server infrastructure. Exchange's major features include email, calendaring, contacts and tasks, support for mobile and web-based access to information, and support for data storage.
TRUSTED BY