After updating a tentacle to powershell 3 I’m seeing the following error:
2013-03-13 21:54:33 ERROR System.Exception: Error when attempting to execute powershell.exe: The system cannot find the file specified —> System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Octopus.Shared.Util.SilentProcessRunner.ExecuteCommand(String executable, String arguments, String workingDirectory, Action1 output, Action1 error) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Util\SilentProcessRunner.cs:line 52
— End of inner exception stack trace —
at Octopus.Shared.Util.SilentProcessRunner.ExecuteCommand(String executable, String arguments, String workingDirectory, Action1 output, Action1 error) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Util\SilentProcessRunner.cs:line 67
at Octopus.Tentacle.Deployment.Integration.PowerShell.FileBasedPowerShellRunner.Execute(PowerShellArguments arguments) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\Integration\PowerShell\FileBasedPowerShellRunner.cs:line 39
at Octopus.Tentacle.Deployment.Integration.PowerShell.PowerShellEngineSelector.Execute(PowerShellArguments arguments) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\Integration\PowerShell\PowerShellEngineSelector.cs:line 11
at Octopus.Tentacle.Deployment.Conventions.PowerShellConvention.RunScript(String scriptName, ConventionContext context) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\Conventions\PowerShellConvention.cs:line 34
at Octopus.Tentacle.Deployment.Conventions.PowerShellDeployScript.Install(ConventionContext context) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\Conventions\PowerShellDeployScript.cs:line 15
at Octopus.Tentacle.Deployment.DeploymentController.RunInstallConventions(ConventionContext context) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\DeploymentController.cs:line 123
at Octopus.Tentacle.Deployment.DeploymentController.Execute(StoredPackage package, VariableDictionary variables, IActivityLog log) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\DeploymentController.cs:line 65
Can you try restarting the Octopus Tentacle windows service, or even (if possible) the machine?
What version of Windows are you running? Octopus works on Windows 8/Server 2012 with PowerShell 3 installed by default but I haven’t tested older OS’s with PowerShell 3.
The server is running 2008 R2. I removed the Powershell 3 update and things started working again. I tried restarting the tentacle and restarting the server, anything else I can try?
I was able to fix this by uninstalling and reinstalling the Tentacle agent. Looks like it picks up the PowerShell location on installation, and when it’s changed, it can’t find it.
We have a somewhat similar problem. We installed powershell 3 on the Octopus server (after Octopus was installed) as it was required for Azure.psd1
Now when we try to run any Azure deploys it can’t find powershell anymore. We really don’t want to have to reinstall the Octopus server, is there any other way around this?
Have you restarted the server since upgrading to PowerShell 3? Can you provide more details about the OS you are using, version of Octopus, and whether you are running 32/64-bit Windows?
The machine is a 64 bit 2008 R2 box running as a VM in Azure. We are currently running version 1.6.0.1714 of Octopus.
This is the original error we got:
2013-06-12 14:41:14 INFO [Azure Deployment] Importing Windows Azure modules
2013-06-12 14:41:14 INFO [Azure Deployment] ERROR: Import-Module : The version of the loaded PowerShell is '2.0'. The module 'C:\P
2013-06-12 14:41:14 INFO [Azure Deployment] ERROR: rogram Files (x86)\Octopus\Server\Azure\Azure.psd1' requires a minimum PowerShe
2013-06-12 14:41:14 INFO [Azure Deployment] ERROR: ll version of '3.0' to execute. Please verify the installation of the PowerShel
2013-06-12 14:41:14 INFO [Azure Deployment] ERROR: l and try again.
We then installed PS3 and rebooted the machine which then gave us the following error:
2013-06-12 15:04:20 DEBUG [Azure Deployment] Script: C:\Octopus\Data\tmp\deployments-1025\BootstrapDeployToAzure.ps1
2013-06-12 15:04:20 ERROR System.Exception: Error when attempting to execute powershell.exe: The system cannot find the file specified ---> System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Octopus.Shared.Util.SilentProcessRunner.ExecuteCommand(String executable, String arguments, String workingDirectory, Action`1 output, Action`1 error) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Util\SilentProcessRunner.cs:line 52
--- End of inner exception stack trace ---
at Octopus.Shared.Util.SilentProcessRunner.ExecuteCommand(String executable, String arguments, String workingDirectory, Action`1 output, Action`1 error) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Util\SilentProcessRunner.cs:line 67
at Octopus.Shared.Integration.Scripting.PowerShell.FileBasedPowerShellRunner.Execute(ScriptArguments arguments) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Integration\Scripting\PowerShell\FileBasedPowerShellRunner.cs:line 51
at Octopus.Shared.Conventions.Implementations.ScriptConvention.RunScript(String scriptName, IConventionContext context) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Conventions\Implementations\ScriptConvention.cs:line 37
at Octopus.Shared.Conventions.Implementations.AzureDeployScriptConvention.Install(IConventionContext context) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Conventions\Implementations\AzureDeployScriptConvention.cs:line 52
at Octopus.Shared.Conventions.ConventionProcessor.Run[TConvention](IConventionContext context, Action`2 conventionCallback) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Conventions\ConventionProcessor.cs:line 75
at Octopus.Shared.Conventions.ConventionProcessor.RunConventions(IConventionContext context) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Conventions\ConventionProcessor.cs:line 29
Installed a fresh VM running Windows Server 2008 R2 with SP1 x64
Installed the .NET 3.5.1 framework using Add/remove windows features
Installed .NET framework 4.0
Installed NDP40-KB2468871-v2-x64 (a hotfix to allow portable class libraries to run)
Tested that Octopus was able to run PowerShell scripts
Installed Windows6.1-KB2506143-x64.msu (update for PowerShell 3.0 in x64 systems)
Restarted the machine
Tested that Octopus was still able to run PowerShell scripts
Can you check that the %PATH% environment variable contains the path to PowerShell.exe?
What account is the Octopus server running under? Can you try changing it to run under a local administrator account to see if that causes the same issue?
Just wanted to confirm the solution for Windows Server 2008 R2. Had just installed Windows6.1-KB2506143-x64.msu and restarted as the patch requires. When server came online, the tentacle failed with the same error as reported above. Restarting the tentacle service solved the problem.
I guess that there are some final steps with the patch that isn’t completed before after the server restart, and thus, the tentacle starts up earlier than these final steps.