-
Notifications
You must be signed in to change notification settings - Fork 86
Description
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
Importing modules in background runspace jobs requires that the module be:
- "Installed" and accessible in
$env:PSModulePath - Passed by name to
Start-RSJobusing the-ModuleToImportparameter
What is the proposed behavior?
Add support for passing a custom module path, from which modules will be imported into background runspace jobs.
This should require no modification of $env:PSModulePath, and shouldn't require the module to be pre-installed on the client. Expecting something similar to how modules are specified for import in psake-config.ps1. Specific use case is a portable CI/CD pipeline that manages PowerShell module dependencies, without relying on Install-Module or a specific build server configuration.
It looks like InitialSessionState.ImportPSModulesFromPath() could work for this, but would make a hard dependency on PowerShell V3. Wasn't sure if PowerShell V2 support was still important based on #162.
Please provide a code example showing the potential feature, if applicable:
Today we pass in one or more module names to import, which have to be accessible with $env:PSModulePath
Start-RSJob -ModulesToImport @("Pester")...Would like to be able to pass in a custom module path, from which one or more modules are imported. Assuming a directory structure of:
Dependencies/
PowerShell/
Modules/
We should be able to:
Start-RSJob -ModulesFromPathToImport ".\Dependencies\PowerShell\Modules"...