Suggestions to debug PS CommandNotFound Exception only when run by tentacle

brian.prince's Avatar

brian.prince

23 Jan, 2018 10:30 PM

Hi - We are having intermittent deployment failures in a script step with a CommandNotFound exception. if you have any thoughts on how to troubleshoot this scenario we would appreciate any feedback.

When we login the server immediately after the issue we can open a shell and run the cmdlet with no issues. Restarting the tentacle and rebooting the server where the command is running do not make a difference.
We have found sometimes the command succeeds after waiting 30 to 60 minutes and retrying.

Today one machine had deployments fail on separate cmdlets (Get-Website and Get-WmiObject) in different deployments.

Details below. We are upgrading to 4.1.x hopefully in 3 days but don't think it will change this behavior.

Thanks!
-Brian

Failed: WebServer01
Octopus Server version: 3.12.6+Branch.master.Sha.5fd77c79b36c7f0307dd3d34b855749a23564bce
Environment Information:
OperatingSystem: Microsoft Windows NT 6.2.9200.0
OsBitVersion: x64
Is64BitProcess: True
CurrentUser: DOMAIN\octoprodacct
MachineName: OctoServer02
ProcessorCount: 2
CurrentDirectory: C:\windows\system32
TempDirectory: C:\Users\octoprodacct\AppData\Local\Temp\
HostProcessName: Octopus.Server
Executing script on 'WebServer01'
Octopus Deploy: Calamari version 3.7.53+Branch.master.Sha.416708ce8cf8a2361f341285ce3655453a1be6f6
Environment Information:
OperatingSystem: Microsoft Windows NT 6.1.7601 Service Pack 1
OsBitVersion: x64
Is64BitProcess: True
CurrentUser: NT AUTHORITY\SYSTEM
MachineName: WebServer01
ProcessorCount: 3
CurrentDirectory: D:\Octopus\Work\20180123203116-1180
TempDirectory: C:\Windows\TEMP\
HostProcessName: Calamari
Executing 'D:\Octopus\Work\20180123203116-1180\Script.ps1'
Name                           Value

PSVersion                      4.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.42000
BuildVersion                   6.3.9600.18728
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion      2.2
PowerShell Environment Information:
OperatingSystem: Microsoft Windows NT 6.1.7601 Service Pack 1
OsBitVersion: x64
Is64BitProcess: True
CurrentUser: NT AUTHORITY\SYSTEM
MachineName: WebServer01
ProcessorCount: 3
CurrentDirectory: D:\Octopus\Work\20180123203116-1180
CurrentLocation: D:\Octopus\Work\20180123203116-1180
TempDirectory: C:\Windows\TEMP\
HostProcessName: powershell
TotalPhysicalMemory: 12582392 KB
AvailablePhysicalMemory: 7385460 KB
Virtual path: /WebAppName
Physical path: D:\inetpub\wwwroot\WebAppName
Application pool: WEBAPP01
Parent site: Default Web Site
Getting web site Default Web Site
Get-WebSite : The term 'Get-WebSite' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At D:\Octopus\Work\20180123203116-1180\Script.ps1:90 char:9
+ $site = Get-WebSite  | where { $_.Name -eq $parentSite }
+         ~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (Get-WebSite:String) [], ParentC
ontainsErrorRecordException
+ FullyQualifiedErrorId : CommandNotFoundException
Updating manifest with output variables
Updating manifest with action evaluated variables
The remote script failed with exit code 1
at Octopus.Worker.Scripting.ScriptResult.EnsureSuccessful() in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Worker\Scripting\ScriptResult.cs:line 97
at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.<>c__DisplayClass28_0.<ExecuteActionAndInitLoggingContext>b__0() in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 324
at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.ExecuteWithTransientErrorDetection(Action action, Machine machine) in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 428
at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.ExecuteActionAndInitLoggingContext(PlannedStep step, Machine machine, PlannedAction action) in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 321
Create IIS Application (IIS7.0) for WebAppPackageName
  1. Support Staff 1 Posted by Henrik Andersso... on 24 Jan, 2018 01:37 AM

    Henrik Andersson's Avatar

    Hi Brian,

    This page has a few suggestions (Trace-Command and Start/Stop-Transcript) that might help you troubleshoot this issue.

    I hope that helps.

    Thank you and best regards,
    Henrik

  2. 2 Posted by brian.prince on 24 Jan, 2018 02:08 PM

    brian.prince's Avatar

    Thanks Henrik.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac