Where does PowerShell look for Modules

November 14, 2015 at 11:34 am 1 comment

One of the great things from PowerShell 3 onwards is that you do not need to import modules to use them so long as they are stored in one of the locations that PowerShell will automatically look for them.  The directories that will be searched are listed in the environment variable PSModulePath.  A quick way to see the directories is:

(Get-Item env:PSModulePath).Value -Split “;”

On my computer, this returns:

C:\Users\Brent\Documents\WindowsPowerShell\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\
C:\Program Files (x86)\Microsoft SQL Server\120\Tools\PowerShell\Modules\

As an aside to this, if you are part of an admin team you can put a UNC path in to this variable so it is possible to have a modules directory on a file share enabling the admin team to easily use and maintain an organisation module.

Advertisements

Entry filed under: Uncategorized.

Creating a Windows Form in PowerShell Personalising PowerShell Commands, or what seemed like a good idea in Redmond isn’t necessarily the best option for me!

1 Comment Add your own

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

November 2015
M T W T F S S
« Feb   Jan »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Most Recent Posts


%d bloggers like this: