Script Module missing functions during deployment

Just upgraded from 2.63.886 to 3.4.3 and I’m experiencing an issue with some Script Modules.

I’ve included the script module in my process, multiple times. But a function within it is not available during deployment.

The name of the function is : Setup-LogonLocally. The first thing that grabs me is that it’s not a ‘proper’ powershell module function Verb. (Set,Remove,etc…). I can see this may be part of the issue as there are other functions Set-LogonAsService that are available. I’m verifying availability via Get-Command. However, this has worked in the past, albeit with a warning in the logs about the non-standard verb.

Is there something new about the way script modules are imported during the deployment now? I looked through the change logs on the website for anything about modules and didn’t see anything relevant to this issue.

Hi David,

Thanks for getting in touch! We haven’t changed anything fundamental about how Script Modules are loaded (to my knowledge). All we do is inline them when building the bootstrap file in Calamari:

As a test could you run your deployment and in the custom script, copy the contents of the script folder to a temporary folder (which should include the Octopus generated Bootstrap script) and take a look in there. All of the functions you defined in the Script Module should be inlined and available.

Hope that helps!

Figured it out. I had a syntax error in my script module. I was using heredocs (@" "@) and I had a ` or a " out of place. Which was causing Powershell to assume a lot of the script was in the string, including the contents of the function in question. Some double quotes later on ‘closed’ the here doc and let the other functions get loaded as expected.

I knew it was something I was doing wrong.

Hi David,

Glad you figured it out! It’s a bummer we can’t make that case easier to discover… If you come up with any thoughts let me know! :slight_smile:

Speak again soon!