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:ScriptsModules;" + $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: ,

Advertisements
This entry was posted in PowerShell V2. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s