How do I remotely run a Powershell workflow that uses a custom module?

Posted by drawsmcgraw on Server Fault See other posts from Server Fault or by drawsmcgraw
Published on 2012-09-06T20:25:14Z Indexed on 2012/09/06 21:41 UTC
Read the original article Hit count: 191

Filed under:
|
|

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?

© Server Fault or respective owner

Related posts about powershell

Related posts about remote