Error executing powershell scripts

Hello there,

When trying to use any powershell script steps in a deployment to a specific box we receive the following error:
@@@
Tentacle script execution
Error 13:24:39
The term ‘C:\Windows\system32\config\systemprofile\AppData\Local\Tentacle\Temp
Error 13:24:39
Bootstrap.769d797a-fa3b-41c3-b022-a3828d84f467.ps1’ is not recognized as the na
Error 13:24:39
me of a cmdlet, function, script file, or operable program. Check the spelling
Error 13:24:39
of the name, or if a path was included, verify that the path is correct and try
Error 13:24:39
again.
Error 13:24:39
At line:1 char:5
Error 13:24:39

  • . {. <<<< ‘C:\Windows\system32\config\systemprofile\AppData\Local\Tentacle\T
    Error 13:24:39
    emp\Bootstrap.769d797a-fa3b-41c3-b022-a3828d84f467.ps1’; if ((test-path variabl
    Error 13:24:39
    e:global:lastexitcode)) { exit $LastExitCode }}
    Error 13:24:39
    • CategoryInfo : Ob********ectNotFound: (C:\Windows\syst…3828d84f467.p
      Error 13:24:39
      s1:String) [], CommandNotFoundException
      Error 13:24:39
    • FullyQualifiedErrorId : CommandNotFoundException
      Info 13:24:39
      ==============================================
      PowerShell exit code: 1
      ==============================================
      Fatal 13:24:39
      PowerShell script returned a non-zero exit code: 1
      Tentacle version 2.5.4.280
      @@@

This error is reproducible on the same box, but not on others, and we were wondering how we might go about debugging this. Additionally, it only seems to be affecting pure powershell script steps; any NuGet package steps that also use deployment scripts work fine.

Cheers,

Caleb

Hi Caleb,

Thanks for getting in touch! To try to get to the bottom of this, could you please let me know:
What version of Windows you are running and is it 32/64 and what version of PowerShell?

Thanks!
Vanessa

That box is running Windows server 2008 R2, it is 64 bit and it is running PowerShell version 2. The boxes it is working on are running Windows 7 (x64), also PowerShell v2. All tentacles are version 2.5.4.280.

Upon further inspection, it seems that all of the working boxes have a collection of hidden boostrap.-.ps1 files in C:\Windows\System32\config\systemprofile\AppData\Local\Tentacle\Temp, which in turn line up with the names of scripts that this box complains about. It seems, therefore, that the script file isn’t getting transferred, for whatever reason, or is being deleted immediately.

I have checked and the local system user (that the Tentacle is running under) has complete read/write access to this folder.

Does this shed some light upon our situation?

Hi Caleb,

Thanks for the extra information, yeah we saw from your first error that it looked like the script wasn’t properly getting placed in the folder and thus asked for the Windows and PowerShell versions.
We are still trying to figure this out, and will get back you to soon. In the mean time if you could provide a full deployment log for the failing deployment that might help.
http://docs.octopusdeploy.com/display/OD/Get+the+raw+output+from+a+task

Thanks!
Vanessa

I have attached the raw log.

ServerTasks-1613.log.txt (7 KB)

Hi Caleb,

Sorry for the delay in getting back to you. We are still at a bit of a loss here, so a screen sharing session might be the only way to get to the bottom of this.
If you could select a suitable time from the following link: https://octopusdeploy.acuityscheduling.com/schedule.php we will help you track this down

Vanessa

In case anyone else is having this issue, the workaround we have found is to set the tentacle to log on as a different user, also with administrator privileges.

Also for anyone stumbling on to the thread, the issue for tracking can be found here:

Vanessa

We ran into this issue as well and fixed it by adjusting the environmental variable on the machine to ensure the first PS path is for the 64 bit version. We did not need to change the user.

On a 64 bit machine:
C:\Windows\SysWOW64\WindowsPowerShell - this is the 32 bit version
C:\Windows\System32\WindowsPowerShell - this is the 64 bit version

I had this issue, and I realisied it occurred since installing Windows Management Framework 5 April 2015 Preview - i.e. powershell 5

Just for the record.

Hi Matt,

Thanks for reaching out. We’ve had issues with the Powershell 5 preview, and at this point we do not recommend to install it on servers running Octopus/Tentacles.

Related topic: http://help.octopusdeploy.com/discussions/problems/34939

Sorry for the inconveniences

Dalmiro