# Copy psexec and any install binaries to your local box, using intensive creds [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [System.Windows.Forms.MessageBox]::Show("Please open a connection to the DFW meida server, and click OK when done") Copy-Item \\media.dfw1.rackspace.com\Critical_Sites\Tools\PSTools\psexec.exe c:\windows\temp\psexec.exe Copy-Item \\\media.dfw1.rackspace.com\Critical_Sites\Production\sysedge\windows\SystemEDGE_5.7 c:\windows\temp\SystemEDGE_5.7 -recurse #Get creds that can be used to log into all customer servers: [System.Windows.Forms.MessageBox]::Show("Please enter credentials that can connect to ALL customer servers, and the Introscope server's private IP") $user = read-host "Enter a user name" $passHash = read-host "Enter a password" -assecurestring $pass = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($passHash)) $Credential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $passHash # Input for hosts we'll be installing the SysEDGE agent on ---------------------------------------------------------------------------------------------------------------------------------------------------- Add-Type -AssemblyName System.Drawing Add-Type -AssemblyName System.Windows.Forms # Create the Label. $label = New-Object System.Windows.Forms.Label $label.Location = New-Object System.Drawing.Size(10,10) $label.Size = New-Object System.Drawing.Size(280,20) $label.AutoSize = $true $label.Text = "Input the public IP for each server you want Introscope installed on. Put ONE IP PER LINE, no spaces:" # Create the TextBox used to capture the user's text. $textBox = New-Object System.Windows.Forms.TextBox $textBox.Location = New-Object System.Drawing.Size(10,40) $textBox.Size = New-Object System.Drawing.Size(575,200) $textBox.AcceptsReturn = $true $textBox.AcceptsTab = $false $textBox.Multiline = $true $textBox.ScrollBars = 'Both' $textBox.Text = "Input IP addresses in this box, ONE per line" # Create the OK button. $okButton = New-Object System.Windows.Forms.Button $okButton.Location = New-Object System.Drawing.Size(510,250) $okButton.Size = New-Object System.Drawing.Size(75,25) $okButton.Text = "OK" $okButton.Add_Click({ $form.Tag = $textBox.Text; $form.Close() }) # Create the Cancel button. $cancelButton = New-Object System.Windows.Forms.Button $cancelButton.Location = New-Object System.Drawing.Size(415,250) $cancelButton.Size = New-Object System.Drawing.Size(75,25) $cancelButton.Text = "Cancel" $cancelButton.Add_Click({ $form.Tag = $null; $form.Close() }) # Create the form. $form = New-Object System.Windows.Forms.Form $form.Text = $WindowTitle $form.Size = New-Object System.Drawing.Size(610,320) $form.FormBorderStyle = 'FixedSingle' $form.StartPosition = "CenterScreen" $form.AutoSizeMode = 'GrowAndShrink' $form.Topmost = $True $form.AcceptButton = $okButton $form.CancelButton = $cancelButton $form.ShowInTaskbar = $true # Add all of the controls to the form. $form.Controls.Add($label) $form.Controls.Add($textBox) $form.Controls.Add($okButton) $form.Controls.Add($cancelButton) # Initialize and show the form. $form.Add_Shown({$form.Activate()}) $form.ShowDialog() > $null # Trash the text of the button that was clicked. Add-Content C:\windows\temp\SysEDGEipaddresses.txt $form.tag # Input for hosts we'll be installing the SysEDGE agent on ---------------------------------------------------------------------------------------------------------------------------------------------------- Get-Content C:\windows\temp\SysEDGEipaddresses.txt | Foreach-object { # SysEDGE INSTALL: --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Map drive to remote machine - This lets BitsTransfer work net use r: \\$_\c$\rs-pkgs /user:$user $pass sleep 2 # Make a directory to put our files in and transfer our binaries to install the dot net agent using BitsTransfer c:\windows\temp\psexec.exe \\$_ -u $user -p $pass cmd.exe /c mkdir C:\rs-pkgs\SystemEDGE_5.7\ Import-Module bitstransfer $sourcePath = "c:\windows\temp\SystemEDGE_5.7\*.*" $destPath = "\\$_\c$\rs-pkgs\SystemEDGE_5.7\" Start-BitsTransfer -Source $sourcePath -Destination $destPath -Credential $Credential #Install the dot net agent, remove install files whe done c:\windows\temp\psexec.exe \\$_ -u $user -p $pass cmd.exe /c C:\rs-pkgs\SystemEDGE_5.7\ca-setup.exe /r answers.txt EULA_ACCEPTED=YES C:\Windows\Temp\PsExec.exe \\$_ -u $user -p $pass powershell remove-item -recurse -force C:\rs-pkgs\SystemEDGE_5.7\ # Unmap the drive Net use /delete R: sleep 1 # SysEDGE INSTALL: --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- } remove-item -recurse -force C:\windows\temp\ipaddresses.txt remove-item -recurse -force C:\windows\temp\IntroscopeDotNetAgentInstall64_9.1.1.1 remove-item -recurse -force C:\windows\temp\psexec.exe