Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.