0

I have a custom Powershell module that I wrote for various tasks. Now I want to craft a workflow whose activities will use commands from the module. Here's my test workflow:

workflow New-TestWorkflow{
    InlineScript {
        Import-Module custom.ps1
        New-CommandFromTheModule
    }
}

Then I run the workflow with:

New-TestWorkflow -PSComputerName remoteComputer

When I do this, the import fails because it can't find the module. I imagine this is because the workflow is executing on the remote machine, where my module does not exist.

I can see myself running this across many machines so I'd really rather not have to install this module and maintain it on all of the machines. Is there some way to have my module in a central place and use it in workflows?

1 Answer 1

0

Looking at this article, I need to use -PSRequiredModules at the end of the activity, which in this case is the entire InlineScript. So...

workflow New-TestWorkflow{
    InlineScript {
        New-CommandFromTheModule
    } -PSRequiredModules custom
}

Tragically, I can't test it from where I am but my recent experience tells me that this is what I would need to do.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .