Loading a PowerShell module in a custom path

By default, PowerShell has a few locations it knows there are modules located.
However, it is possible to load a module that’s residing in some custom path.
Note that IntelliSense and/or tab-completion won’t work in that case until you’ve loaded the module.
This is because it’s not located in a path known to the $Env:PSModulePath variable.
When a module resides in a path known in the $Env:PSModulePath variable, tab-completion for the cmdlets and even IntelliSense for those cmdlets will work.
So you can either edit the variable, move the module to a location known in the $Env:PSModulePath variable, or use my solution.

In PowerShell the is a beautiful thing called a profile. There even is a variable for it called $Profile.
This variable refers to a *.ps1 file.
Anything placed in this file is executed when you start a PowerShell prompt, or ISE.
But… by default there it refers to a file that doesn’t exist! So you’ll have to create it:

Please note that the -Force parameter will overwrite any profile that may be there already!

Now that the file is created, you can put some code in there to load the module:

Leave a Reply

Your email address will not be published. Required fields are marked *