Custom Powershell Step not executing in some tentacle

juan.obligado's Avatar

juan.obligado

14 Jul, 2017 02:15 PM

Do have a custom powershell step for stopping a service. Custom step is running in some machines but not running at all in other deployment targets.

  • Manually running from the script console to UAT script runs perfectly fine.

  • Also something that i notice it that in the failing environment, tentacle logs that is trying to use powershell v1.0

INFO Starting C:\Windows\system32\WindowsPowershell\v1.0\PowerShell.exe in C:\Octopus\Work\20170714135217--3

  1. Support Staff 1 Posted by Matthew Caspers... on 16 Jul, 2017 11:53 PM

    Matthew Casperson's Avatar

    Hi Juan, thanks for reaching out.

    Could you please enable the variables in the deployment log using the instructions at https://octopus.com/docs/how-to/debug-problems-with-octopus-variabl... and post a copy of the log file. This will help us diagnose the issue further.

    Regards
    Matt C

  2. 2 Posted by juan.obligado on 17 Jul, 2017 01:45 AM

    juan.obligado's Avatar

    Hi Matt,

    Please see attached deploy log file, with debug variables.

    Thanks,
    Juan

  3. Support Staff 3 Posted by Matthew Caspers... on 17 Jul, 2017 04:08 AM

    Matthew Casperson's Avatar

    Hi Juan, thanks for providing those additional log files.

    Powershell being launched from C:\Windows\system32\WindowsPowershell\v1.0\PowerShell.exe is not unusual. This doesn’t necessarily mean that Powershell V1.0 is being run. My understanding is that this path has been keep for all versions of Powershell. You can confirm this by looking at the PSVersion log output that is displayed for a script step. In the log file you have attached, you are running Powershell v4.0.

    21:38:18   Verbose  |       Name                           Value
    21:38:18   Verbose  |       ----                           -----
    21:38:18   Verbose  |       PSVersion                      4.0
    21:38:18   Verbose  |       WSManStackVersion              3.0
    21:38:18   Verbose  |       SerializationVersion           1.1.0.1
    21:38:18   Verbose  |       CLRVersion                     4.0.30319.36366
    21:38:18   Verbose  |       BuildVersion                   6.3.9600.17400
    21:38:18   Verbose  |       PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
    21:38:18   Verbose  |       PSRemotingProtocolVersion      2.2
    

    Nothing in the log file appears out of place. You are running version 3.3.1 which is quite old now, so I would recommend upgrading Octopus Deploy as some of the functionality around launching scripts has changed.

    Regards
    Matt C

  4. 4 Posted by juan.obligado on 13 Oct, 2017 08:41 PM

    juan.obligado's Avatar

    Hi Matt,
    Unfourtunately still having this issue. Seems something related with the process that am trying to run, if using a smaller process am able to execute powershell correctly however if

    Something interesting is that the process that failes, is not writing Powershell Environment information in the log

    Thats the process that runs ok writes:

    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
    PSRemotingProtocolVersion 2.2
    PowerShell Environment Information: OperatingSystem: Microsoft Windows NT 6.3.9600.0 OsBitVersion: x64 Is64BitProcess: True CurrentUser: OPTIMIST\buildadm MachineName: DEVQA ProcessorCount: 4 CurrentDirectory: C:\Octopus\Work\20171013195325-21889-40 CurrentLocation: C:\Octopus\Work\20171013195325-21889-40 TempDirectory: C:\Users\buildadm\AppData\Local\Temp\ HostProcessName: powershell TotalPhysicalMemory: 6290928 KB AvailablePhysicalMemory: 1202432 KB <<script output>>
    The failing process completely misses this
    Name                           Value                                           
    ----                           -----                                           
    PSVersion                      4.0                                             
    WSManStackVersion              3.0                                             
    SerializationVersion           1.1.0.1                                         
    CLRVersion                     4.0.30319.34209                                 
    October 13th 2017 17:16:13Verbose
    BuildVersion                   6.3.9600.17400                                  
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}                            
    PSRemotingProtocolVersion      2.2                                             
    <<NO SCRIPT OUTPUT>>
    Updating manifest with output variables
    Updating manifest with action evaluated variables
    

    Any idea on what might be causing this fail and how can debug why powershell is not running? again doesnt seem powershell script nor machine but the process that launches powershell

  5. Support Staff 5 Posted by Shane Gill on 16 Oct, 2017 05:17 AM

    Shane Gill's Avatar

    Hi Juan,

    That is very strange.

    It looks like deploying packages to the machine "UAT" executed ok in the same deployment. Can you deploy a simple "hello world" script on UAT? Can you deploy "Hello world" to UAT as a part of that same deployment?

    Cheers,
    Shane

  6. 6 Posted by juan.obligado on 16 Oct, 2017 12:12 PM

    juan.obligado's Avatar

    Hi Shane,

    Good Morning, Indeed if deploying an empty project with just a hello world
    script it deploys and runs powershell script without any issue.
    Any idea on how would be able to do the debugging of this?
    Thanks,
    Juan

  7. Support Staff 7 Posted by Shane Gill on 17 Oct, 2017 02:52 AM

    Shane Gill's Avatar

    Hi Juan,

    I can't see why it wouldn't be working. Running from the script console is the usual way to debug. There is not much more you can do.

    I think Matt's recommendation to update the Server may help, we have made a lot of bug fixes and provide additional logging in more recent versions. There is also PowerShell debugging which may help in this circumstance, but requires PowerShell 5.

    Cheers,
    Shane

Reply to this discussion

Internal reply

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

Attaching KB article:

»

Already uploaded files

  • 2017-07-14_11_12_19-Script_run_from_management_console_-_Octopus_Deploy.png 17.5 KB
  • 2017-07-14_11_14_43-Deploy_OMS_release_1.2.1296_to_Dev_QA_-_Octopus_Deploy.png 30.3 KB
  • 2017-07-14_11_13_49-Deploy_OMS_release_1.2.1296_to_UAT_-_Octopus_Deploy.png 22.1 KB

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