Import PowerShell Module in PowerShell script step

(Andrew Weaver) #1

Hi,

I have an internally published PowerShell module on our NuGet feed.

I need to call Import-Module (possibly via a Save-Module) to get those commands into my PowerShell script step running directly on the Octopus Server.

How do we import modules in a step?

(Daniel Fischer) #3

Hi Andrew,

Thanks for getting in touch! It looks like you could benefit from our Script Modules feature. From your description it sounds like what you need.

If this is not exactly what you are after in the case, please let me know. :slight_smile:

Best regards,
Daniel

(Clayton Armstrong) #4

I know this is quite old, but the response did not answer the question.
I have a similar question.

Script modules don’t help, as they allow you to enter/save/share script snippets directly into Octopus.
They are not relevant to try to use the functions in existing powershell modules (that are not directly pasted into Octopus)

The OP was asking how to reference the functions published in a Nuget package.
I’m trying to understand how to reference the functions in third-party Powershell modules that are installed on the Octopus server.

How does one make powershell modules available from script steps?