Created
February 5, 2014 14:00
-
-
Save jamescrowley/8824137 to your computer and use it in GitHub Desktop.
Powershell script for updating Octopus Tentacles to 2.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Uninstall-OldTentacle { | |
Write-Output "Uninstalling the 1.0 Tentacle" | |
$app = Get-WmiObject -Query "SELECT * FROM Win32_Product WHERE Name = 'Octopus Deploy Tentacle' AND Version < 2.0" | |
$app.Uninstall() | |
& sc.exe delete "Octopus Tentacle" | |
} | |
function Upgrade-Tentacle | |
{ | |
Write-Output "Beginning Tentacle installation" | |
Write-Output "Downloading Octopus Tentacle MSI..." | |
$downloader = new-object System.Net.WebClient | |
$downloader.DownloadFile("http://download.octopusdeploy.com/octopus/Octopus.Tentacle.2.0.13.1100-x64.msi", "Tentacle.msi") | |
Write-Output "Installing MSI" | |
$msiExitCode = (Start-Process -FilePath "msiexec.exe" -ArgumentList "/i Tentacle.msi /quiet" -Wait -Passthru).ExitCode | |
Write-Output "Tentacle MSI installer returned exit code $msiExitCode" | |
if ($msiExitCode -ne 0) { | |
throw "Installation aborted" | |
} | |
Write-Output "Configuring and registering Tentacle" | |
cd "${env:ProgramFiles}\Octopus Deploy\Tentacle" | |
Write-Output "Configuring the 2.0 Tentacle" | |
& .\tentacle.exe create-instance --instance "Tentacle" --config "${env:SystemDrive}\Octopus\Tentacle\Tentacle.config" --console | |
& .\tentacle.exe configure --instance "Tentacle" --home "${env:SystemDrive}\Octopus" --console | |
& .\tentacle.exe configure --instance "Tentacle" --app "${env:SystemDrive}\Octopus\Applications" --console | |
& .\tentacle.exe configure --instance "Tentacle" --port "10933" --console | |
& .\tentacle.exe configure --instance "Tentacle" --trust="*** ENTER OCTOPUS KEY HERE ***" | |
& .\tentacle.exe import-certificate --instance "Tentacle" --from-registry --console | |
Write-Output "Stopping the 1.0 Tentacle" | |
Stop-Service "Octopus Tentacle" | |
Write-Output "Starting the 2.0 Tentacle" | |
& .\tentacle.exe service --instance "Tentacle" --install --start | |
Write-Output "Tentacle commands complete" | |
} | |
Upgrade-Tentacle | |
Uninstall-OldTentacle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment