Where the heck is the PowerShell Module loading from?

If you’re anything like me you always have PowerShell open, and often both PowerShell and Windows PowerShell. And PowerShell in VSCode and Terminal (and sometimes Jupyter Notebook, and WSL – Windows Subsystem for Linux).

There WILL come a point on Windows when you want to know where the heck is the PowerShell Module loading from (especially when using Windows PowerShell). Maybe you want to look inside the module to tweak it or understand how it is or isn’t working.

Windows PowerShell

The common module installation paths are:

  • C:\Windows\System32\WindowsPowerShell\v1.0\Modules
  • C:\Users\<yourprofilename>\Documents\WindowsPowerShell\Modules
  • C:\Program Files\WindowsPowerShell\Modules
  • C:\Program Files (x86)\WindowsPowerShell\Modules

PowerShell

The typical path is:

  • C:\Users\<yourprofilename>\Documents\PowerShell\Modules

Alternative Solution – Where the heck is the PowerShell Module loading from?

Rather than opening each of the folders where modules could be located, running the following one-liner from your PowerShell session will show the module version(s) and location(s).

$(Get-Module <modulename> -ListAvailable | select-object).path
Where the heck is the PowerShell Module loading from?

To open the location in explorer the following one-liner will take the first location found for the module and open the path in Explorer.

explorer.exe (Split-Path $(Get-Module <modulename> -ListAvailable | select-object -First 1).path -Parent)
Where the heck is the PowerShell Module loading from? Here

Summary

Hopefully this helps someone else. If nothing else I know I’ll be able to quickly find the one-liner with explorer syntax to open the location and answer that often frustration question, “Where the heck is the PowerShell Module loading from?”