Scissor
Virtuoso
Virtuoso

PSModulePath missing default folder after PowerCLI 6 installation

On a fresh install of Windows 8.1, the '%userprofile%\Documents\WindowsPowerShell\Modules' folder is included in $env:PSModulePath.  After installation of PowerCLI 6.0 I see that folder is no longer included.  This breaks people who have installed modules under their Documents directory.

The problem is linked to Environment variables.  A fresh install of Windows has a SYSTEM PSModulePath variable defined but no USER one.  In this situation PowerShell appears to silently add '%userprofile%\Documents\WindowsPowerShell\Modules' to $env:PSModulePath.

If you create a USER PSModulePath variable then this silent behavior changes.  The PowerCLI 6.0 installer does create a USER PSModulePath variable if one does not already exist.

This behavior is also called out near the bottom of this blog posting:  https://www.sapien.com/blog/2012/05/22/psmodulepath-discrepancies/

I'm not sure what the best way is for the PowerCLI 6 installer to address this.  Perhaps it can be added to the release notes at least.

0 Kudos
1 Reply
LucD
Leadership
Leadership

To add to this, passing ALLUSERS=1 to the installation, still adds to the user environment variable.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos