Skip to content

Instantly share code, notes, and snippets.

@jamescrowley
Created February 5, 2014 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamescrowley/8824137 to your computer and use it in GitHub Desktop.
Save jamescrowley/8824137 to your computer and use it in GitHub Desktop.
Powershell script for updating Octopus Tentacles to 2.x
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