Question

The following technique has worked successfully for PowerShell v2 & 3.

$env:PSModulePath += ';.\Modules'

This has allowed a Modules folder to be distributed with scripts without having to explain to the end user how to install PowerShell Modules. As of PowerShell v4, it no longer works. Running Get-Module -ListAvailable does not show the modules stored there. I wasn't able to find anything in the release notes on this change. Is there a new syntax for relative references in PowerShell v4? Is it a bug? Or intended?

Was it helpful?

Solution

Easy enough to work around!

$env:PSModulePath += ";$(Resolve-Path .\Modules)"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top