Module path

PowerShell v2 has 2 default locations for modules – in the install directory and in your profile.  My demo laptop is set to dual boot Windows 7 & Windows 2008 R2.  It would make sense to only maintain one set of files for the modules I write. There is a PowerShell automatic variable that sets where PowerShell looks for modules.  To add my own folder to that path I just add

$env:PSModulePath = "C:\Scripts\Modules;" + $env:PSModulePath

to my profile.  The modules will be available now from either machine.  Need to change drive letter in the Win 2008 profile but otherwise just the same.

Technorati Tags: ,
Published Sun, Aug 30 2009 19:21 by RichardSiddaway

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above: