Where do modules live?
PowerShell defines an environment variable called PSMODULEPATH
, which contains a list of folders that it checks for modules. Viewing PSMODULEPATH
is simplified by the –split
operator to split the path wherever it sees a semicolon:
Here, you can see that there are four folders where PowerShell is looking for modules in this session. For it to find our AreaFunctions
module, there needs to be a AreaFunctions
subfolder in one of these locations with our psm1
file in it.
Once we have created a folder and placed the AreaFunctions.psm1
file in it, we can import the module by name rather than by path: