[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [System.Windows.Forms.MessageBox]::Show("Before starting this ensure that you're logged into this server using your intensive account. If they're in a workgroup or their own domain, then open an active SMB connection to the meida server before starting!") #---------------------------------------------------------------------------------------------------------------- # Select the data center with an input box using radial buttons #---------------------------------------------------------------------------------------------------------------- [Void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [Void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") # Main form $objForm = New-Object System.Windows.Forms.Form $objForm.Text = "" $objForm.Size = New-Object System.Drawing.Size(500,300) $objForm.StartPosition = "CenterScreen" $objForm.FormBorderStyle = "FixedSingle" $objForm.MaximizeBox = $false $objForm.KeyPreview = $True $objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter") {$drv=$objListBox.SelectedItem;$objForm.Close()}}) $objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape") {$drv=$null;$objForm.Close()}}) # Group Box one $drvGbox = New-Object System.Windows.Forms.GroupBox $drvGbox.Location = New-Object System.Drawing.Size(10,30) $drvGbox.Size = New-Object System.Drawing.Size(300,500) $drvGbox.Text = "Select the data center the customer is in:" $objForm.Controls.Add($drvGbox) # Group Box two $fixGbox = New-Object System.Windows.Forms.GroupBox $fixGbox.Location = New-Object System.Drawing.Size(300,30) $fixGbox.Size = New-Object System.Drawing.Size(115,300) $fixGbox.Text = "" $objForm.Controls.Add($fixGbox) $RadioButton1 = New-Object System.Windows.Forms.RadioButton $RadioButton1.Location = new-object System.Drawing.Point(15,15) $RadioButton1.size = New-Object System.Drawing.Size(80,20) $RadioButton1.Text = "DFW" $drvGbox.Controls.Add($RadioButton1) $RadioButton2 = New-Object System.Windows.Forms.RadioButton $RadioButton2.Location = new-object System.Drawing.Point(15,45) $RadioButton2.size = New-Object System.Drawing.Size(80,20) $RadioButton2.Text = "ORD" $drvGbox.Controls.Add($RadioButton2) $RadioButton3 = New-Object System.Windows.Forms.RadioButton $RadioButton3.Location = new-object System.Drawing.Point(15,75) $RadioButton3.size = New-Object System.Drawing.Size(80,20) $RadioButton3.Text = "IAD" $drvGbox.Controls.Add($RadioButton3) $RadioButton4 = New-Object System.Windows.Forms.RadioButton $RadioButton4.Location = new-object System.Drawing.Point(15,105) $RadioButton4.size = New-Object System.Drawing.Size(80,20) $RadioButton4.Text = "LON" $drvGbox.Controls.Add($RadioButton4) $RadioButton5 = New-Object System.Windows.Forms.RadioButton $RadioButton5.Location = new-object System.Drawing.Point(15,135) $RadioButton5.size = New-Object System.Drawing.Size(80,20) $RadioButton5.Text = "HKG" $drvGbox.Controls.Add($RadioButton5) $RadioButton6 = New-Object System.Windows.Forms.RadioButton $RadioButton6.Location = new-object System.Drawing.Point(15,165) $RadioButton6.size = New-Object System.Drawing.Size(80,20) $RadioButton6.Text = "SYD" $drvGbox.Controls.Add($RadioButton6) $OK1Button = New-Object System.Windows.Forms.Button $OK1Button.Location = New-Object System.Drawing.Size(30,40) $OK1Button.Size = New-Object System.Drawing.Size(75,20) $OK1Button.Text = "OK" $OK1Button.Add_Click({$drv=$objListBox.SelectedItem;$objForm.Close()}) $fixGbox.Controls.Add($OK1Button) # Cancel button $Cancel1Button = New-Object System.Windows.Forms.Button $Cancel1Button.Location = New-Object System.Drawing.Size(30,65) $Cancel1Button.Size = New-Object System.Drawing.Size(75,20) $Cancel1Button.Text = "Cancel" $Cancel1Button.Add_Click({$drv=$null;$objForm.Close()}) $fixGbox.Controls.Add($Cancel1Button) $objForm.Topmost = $True $objForm.Add_Shown({$objForm.Activate()}) [void] $objForm.ShowDialog() if ($RadioButton1.Checked -eq $true) {$DC="DFW1"} if ($RadioButton1.Checked -eq $true) {$spectrum="72.3.141.208"} if ($RadioButton2.Checked -eq $true) {$DC="ORD1"} if ($RadioButton2.Checked -eq $true) {$spectrum="184.106.13.160"} if ($RadioButton3.Checked -eq $true) {$DC="IAD1"} if ($RadioButton3.Checked -eq $true) {$spectrum="173.203.179.56"} if ($RadioButton4.Checked -eq $true) {$DC="LON"} if ($RadioButton4.Checked -eq $true) {$spectrum="83.138.176.26"} if ($RadioButton5.Checked -eq $true) {$DC="HKG1"} if ($RadioButton5.Checked -eq $true) {$spectrum="180.150.153.168"} if ($RadioButton6.Checked -eq $true) {$DC="SYD2"} if ($RadioButton6.Checked -eq $true) {$SpectrumIP=""} #---------------------------------------------------------------------------------------------------------------- # End the data center selection #---------------------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------------------- # Retreive variable data about account, device, community string, and public IP #---------------------------------------------------------------------------------------------------------------- [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") $objForm = New-Object System.Windows.Forms.Form $objForm.Text = "Data Entry Form" $objForm.Size = New-Object System.Drawing.Size(300,310) $objForm.StartPosition = "CenterScreen" $objForm.KeyPreview = $True $objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter") {$x=$objTextBox.Text;$objForm.Close()}}) $objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape") {$objForm.Close()}}) $OKButton = New-Object System.Windows.Forms.Button $OKButton.Location = New-Object System.Drawing.Size(75,250) $OKButton.Size = New-Object System.Drawing.Size(75,23) $OKButton.Text = "OK" $OKButton.Add_Click({$x=$objTextBox.Text;$objForm.Close()}) $objForm.Controls.Add($OKButton) $CancelButton = New-Object System.Windows.Forms.Button $CancelButton.Location = New-Object System.Drawing.Size(150,250) $CancelButton.Size = New-Object System.Drawing.Size(75,23) $CancelButton.Text = "Cancel" $CancelButton.Add_Click({$objForm.Close()}) $objForm.Controls.Add($CancelButton) $objLabel = New-Object System.Windows.Forms.Label $objLabel.Location = New-Object System.Drawing.Size(10,20) $objLabel.Size = New-Object System.Drawing.Size(280,20) $objLabel.Text = "Please enter the following data:" $objForm.Controls.Add($objLabel) $objLabel = New-Object System.Windows.Forms.Label $objLabel.Location = New-Object System.Drawing.Size(10,50) $objLabel.Size = New-Object System.Drawing.Size(280,20) $objLabel.Text = "CORE account number:" $objForm.Controls.Add($objLabel) $objTextBox = New-Object System.Windows.Forms.TextBox $objTextBox.Location = New-Object System.Drawing.Size(10,70) $objTextBox.Size = New-Object System.Drawing.Size(260,20) $objForm.Controls.Add($objTextBox) $objLabel = New-Object System.Windows.Forms.Label $objLabel.Location = New-Object System.Drawing.Size(10,100) $objLabel.Size = New-Object System.Drawing.Size(280,20) $objLabel.Text = "Server's full name from CORE:" $objForm.Controls.Add($objLabel) $objTextBox1 = New-Object System.Windows.Forms.TextBox $objTextBox1.Location = New-Object System.Drawing.Size(10,120) $objTextBox1.Size = New-Object System.Drawing.Size(260,20) $objForm.Controls.Add($objTextBox1) $objLabel = New-Object System.Windows.Forms.Label $objLabel.Location = New-Object System.Drawing.Size(10,150) $objLabel.Size = New-Object System.Drawing.Size(280,20) $objLabel.Text = "SNMP community string:" $objForm.Controls.Add($objLabel) $objTextBox2 = New-Object System.Windows.Forms.TextBox $objTextBox2.Location = New-Object System.Drawing.Size(10,170) $objTextBox2.Size = New-Object System.Drawing.Size(260,20) $objForm.Controls.Add($objTextBox2) $objLabel = New-Object System.Windows.Forms.Label $objLabel.Location = New-Object System.Drawing.Size(10,200) $objLabel.Size = New-Object System.Drawing.Size(280,20) $objLabel.Text = "Server's public IP:" $objForm.Controls.Add($objLabel) $objTextBox3 = New-Object System.Windows.Forms.TextBox $objTextBox3.Location = New-Object System.Drawing.Size(10,220) $objTextBox3.Size = New-Object System.Drawing.Size(260,20) $objForm.Controls.Add($objTextBox3) $objForm.Topmost = $True $objForm.Add_Shown({$objForm.Activate()}) [void] $objForm.ShowDialog() $AcctNum = $objTextBox.text $ServerName = $objTextBox1.text $SnmpString = $objTextBox2.text $ServerIP = $objTextBox3.text #---------------------------------------------------------------------------------------------------------------- # Retreive variable data about account, device, community string, and public IP #---------------------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------------------- # Install SysEDGE #---------------------------------------------------------------------------------------------------------------- # Copy Binaries Copy-Item \\media.$DC.rackspace.com\Critical_Sites\Production\sysedge\windows\SystemEDGE_5.7\ c:\rs-pkgs\ -recurse # Install SysEDGE Start-Process -FilePath "C:\rs-pkgs\SystemEDGE_5.7\ca-setup.exe" -ArgumentList "/r answers.txt EULA_ACCEPTED=YES" -wait -passthru # Delete Files remove-item C:\rs-pkgs\SystemEDGE_5.7\ -recurse -force sleep 10 #---------------------------------------------------------------------------------------------------------------- # Install SysEDGE #---------------------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------------------- # Copy and configure the config file #---------------------------------------------------------------------------------------------------------------- Copy-Item \\media.$DC.rackspace.com\Critical_Sites\Production\sysedge\windows\SystemEDGE_5.7\SystemEDGE_Config_File\sysedge.cf c:\users\public\ca\SystemEDGE\port1691\sysedge.cf (Get-Content "C:\users\public\ca\SystemEDGE\port1691\sysedge.cf") | Foreach-Object {$_ -replace "", "$DC"} | Foreach-Object {$_ -replace "", "$AcctNum"} | Foreach-Object {$_ -replace "", "$ServerName"} | Foreach-Object {$_ -replace "", "$SnmpString"} | Foreach-Object {$_ -replace "", "$ServerIP"} | Foreach-Object {$_ -replace "", "$spectrum"} | Set-Content "C:\users\public\ca\SystemEDGE\port1691\sysedge.cf" #---------------------------------------------------------------------------------------------------------------- # Copy and configure the config file #---------------------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------------------- # Clear mon file #---------------------------------------------------------------------------------------------------------------- Stop-Service SysEDGE remove-item -force C:\users\public\ca\SystemEDGE\port1691\sysedge.mon Start-Service SysEDGE #---------------------------------------------------------------------------------------------------------------- # Clear mon file #----------------------------------------------------------------------------------------------------------------