I use below script to download and install tentacle on a dynamically provisioned machine. The script also creates a bat file and executes it to configure the tentacle (stuff copied from “copy script” when performing manual configuration). The tentacle msi is successfully downloaded and installed, but when i run this script on octopus I get can not fin octopus tentacle service.
But rdp ing into the macine and manually executing the bat file configures it correctly
…
$remoteSession = New-PSSession -ComputerName $remoteIp -Credential $cred
Invoke-Command -Session $remoteSession -ScriptBlock{
$installerDirectory = “C:\downloads\octopus\tentacle”
$installerPath = $installerDirectory + “\Octopus.Tentacle.3.8.1-x64.msi”
if (!(Test-Path $installerPath))
{
[System.Net.ServicePointManager]::SecurityProtocol = @("Tls12","Tls11","Tls","Ssl3")
[system.io.directory]::CreateDirectory($installerDirectory)
$installerUrl = "http://octopus.com/downloads/latest/WindowsX64/OctopusTentacle"
Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath
}
msiexec /i $installerPath /passive
$batPath = "c:\TentacleConfig.bat"
If (Test-Path $batPath)
{
Remove-Item $batPath
}
New-Item $batPath -ItemType file
Add-Content $batPath '"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" create-instance --instance "Tentacle" --config "C:\Octopus\Tentacle.config"'
Add-Content $batPath '"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" new-certificate --instance "Tentacle" --if-blank'
Add-Content $batPath '"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" configure --instance "Tentacle" --reset-trust'
Add-Content $batPath '"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" configure --instance "Tentacle" --home "C:\Octopus" --app "C:\Octopus\Applications" --port "10933" --noListen "True"'
Add-Content $batPath '"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" service --instance "Tentacle" --stop --console'
Add-Content $batPath '"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" polling-proxy --instance "Tentacle" --proxyEnable "False" --proxyUsername "" --proxyPassword "" --proxyHost "" --proxyPort ""'
Add-Content $batPath '"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" service --instance "Tentacle" --start'
Add-Content $batPath '"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" register-with --instance "Tentacle" --server "http://mo.octo.server.jaconline.com/OctopusDeploy" --name "TempSrcChanged" --comms-style "TentacleActive" --server-comms-port "10943" --force --username "administrator" --password "brightSide01" --environment "QA" --role "QA_IVector_TempDatabase_test" --policy "Default Machine Policy"'
Add-Content $batPath '"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" service --instance "Tentacle" --install --start'
Start-Process "c:\TentacleConfig.bat"
#Get-Service -Name "OctopusDeploy Tentacle" | Set-Service -Status Running
}
$remoteSession = New-PSSession -ComputerName 51.141.9.176 -Credential $cred
Invoke-Command -Session $remoteSession -ScriptBlock{
Start-Service “octopusdeploy tentacle”
}