PowerShell Genie

PowerShell: module not found

Error 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Check module installation, name and PSModulePath when PowerShell cannot find the requested module.

What it means

PowerShell walked every path in $env:PSModulePath and found no folder matching the module name. This is a discovery failure and not a load failure. A module installed for a different PowerShell edition or under a different user profile looks absent from here.

Likely causes

  • The module was never installed on this machine
  • It was installed with -Scope CurrentUser under your interactive account while the job runs as a service account
  • The module sits in the Windows PowerShell 5.1 module path and the session is PowerShell 7, or the reverse
  • The folder name on disk does not match the module name declared inside the manifest
  • A version subfolder is missing its .psd1 file, so the whole directory is skipped

Check

1PS> $ModuleName = 'ActiveDirectory'
2PS> Get-Module -ListAvailable $ModuleName
3PS> $env:PSModulePath -split ';'

Run these checks before changing anything.

What these checks establish

An empty ListAvailable result means this session did not discover the requested module. Inspect its actual search paths and running identity before deciding whether installation is needed.

Fix

Compare module name, requested version, directory layout and PSModulePath. A module installed under another user’s CurrentUser scope may be unavailable to a service account. Use the supported installation method for that module: some ship with Windows or a product rather than the gallery. Do not copy a working host’s module tree indiscriminately.

Verify: Open the intended PowerShell edition as the intended execution identity; verify discovery and import separately.

Reference

Microsoft Learn: about_psmodulepath

Continue
Genie guidePowerShell: module not found

Check module installation, name and PSModulePath when PowerShell cannot find the requested module.