liveBook · Manning

PSModulePath environment variable

As explained in Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools

The PSModulePath environment variable contains the directories that PowerShell searches for modules.

PSModulePath contains the directories PowerShell searches for modules. Checking it helps you choose where to save a module so PowerShell can discover and load it automatically. section 10.2

Use the path list to make module placement predictable:

  • Inspect the directories with $env:PSModulePath -split ";". section 10.2 section 10.4
  • For production, place a module beneath a listed directory, using a subfolder and filename that match the module name. section 10.2
  • Use a Documents-based module path for experimentation, reserving Program Files locations for production modules. section 10.2
$env:PSModulePath

Inspect the directories PowerShell searches before troubleshooting module discovery. section 10.4

How Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools covers it

How deep it goes
Defines path inspection, default locations, and naming requirements, but does not detail environment-variable customization.
Examples
Uses $env:PSModulePath -split ";" and contrasts Documents with Program Files module locations.
What it assumes
Assumes familiarity with PowerShell modules and introduces default module locations through practical inspection.
What you can do after
Operate/configure it to verify searchable directories and place modules where PowerShell can discover them.
How it connects
Connects module discovery with script modules, Import-Module, and Remove-Module.

Also explained in

Compare how 2 books explain PSModulePath environment variable →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools. The section links point to the parts of the book it draws on.