PS.exec script to install, configure and register Octopus Tentacle

Hi, I have powershell script o install, create and register Octopus Tentacle.
However I am unable to do that in PS.exec command prompt as it doesnt execute the powershell script properly and needs manual intervention to press Enter to go to next command everytime.
Can you please provide PS.exec script to do this activity?

Hi Pratik,

Thanks for reaching out.

  • None of our Tentacle install/registration scripts should require a manual intervention or hitting any keys. Could you share us the Octopus script you are trying to run?

  • Is there any reasons why you are using PSExec instead of Powershell remoting? I’m pretty sure you’ll have better results if you use PSRemoting which handles powershell code much better than PSExect usually. In fact, our scripts were written thinking about PSRemoting which is a built-in feature in windows and not PSExect which is a 3rd party tool you have to download separately.

Regards,
Dalmiro

Thanks for quick response. I am trying to install, create and register tentacle from the tentacle machine itself.
Is it possible to do these activities using DOS command from remote command prompt?
The reason for asking this is, the powershell script doesn’t run as expected on Psexec command prompt.
I have written code for installing and creating Tentacle. However for registering, it needs to read from the CSV file. Please see attached script.

InstallCreateRegister_Tentacle.txt (848 Bytes)

machines.csv (240 Bytes)

powershell script to register tentacle is below, but i am trying to do this in DOS command instead of powershell
$OctopusThumbprint = “89374589347583745873458375839934754354442” # Your Octopus Thumbprint
$OctopusUrl = “http://10.43.2.13/octopus” # Your Octopus URL
$OctopusApiKey = “API-hg9fhr908ge8gyegegh9erghe9rhg8” # Your Octopus API Key (from your profile)
$computerName = $env:computername
$machineEntry = Import-Csv machines.csv | Where-Object {$_.Name -eq $computerName} | Select-Object -first 1
cd “C:\Program Files\Octopus Deploy\Tentacle"
function Register-Tentacle ([string] $name, [string] $environments, [string] $roles) {
$rolesArgs = $roles.Split(”,") | Foreach {$r=""} {$r+="–role "$_" “} {$r}
$environmentsArgs = $environments.Split(”,") | Foreach {$e=""} {$e+="–env "$_" "} {$e}
iex ".\Tentacle.exe --console register-with --instance "Tentacle" --server "$OctopusUrl" --apiKey "$OctopusApiKey" $rolesArgs $environmentsArgs --name "$name“”
}
Register-Tentacle $machineEntry.Name $machineEntry.Environments $machineEntry.Roles

Quick help would be much appreciated.

Hi Pratik,

I noticed that you have another ticket open for this exact same query via email with my teammate Shane. I’m gonna need to ask you to follow that conversation in that thread, and for future reference please do not duplicate questions over different channels.

Regards,
Dalmiro