Pcornel
Windows · PowerShell

Modules

Cheat sheet · https://pcornel.dk/topic.php?topic=3046

Back to the Topic

Answer

A PowerShell module is a reusable package of commands, types/resources and metadata. Module discovery depends on paths and manifests; import can load a specific implementation/version into the session, while PowerShell 7 may use compatibility mechanisms for some Windows PowerShell modules.

Remember

  • Module availability is not the same as module import, and import is not the same as command success.
  • PSModulePath and module manifests influence discovery/version selection.
  • Auto-loading can hide when a module was brought into the session.
  • PowerShell 7 and Windows PowerShell 5.1 can have different module compatibility.
  • Importing one version can change command/type behavior expected by an existing script.

First checks

  • Get-Module -ListAvailable <name> — installed versions
  • $PSVersionTable — PowerShell edition and version
  • Get-Command <name> — which cmdlet/function/exe runs
  • Get-Help <cmdlet> -Full — syntax and parameters
  • Get-ExecutionPolicy -List — execution policy per scope

Verify in this order

module in PSModulePath → imported (auto or explicit) → commands available

Where it usually breaks

First mismatch in definition/configuration → security context → service/task/process creation → runtime state → output/side effect → event/performance evidence; preserve identity/native error/pre-state before mutation.

PowerShell → Modules reference map

ItemMeaningEvidence boundary
DiscoveryModule found on search pathnot proof it can import
ManifestMetadata/dependencies/compatibilitymetadata can be incomplete or environment-specific
ImportLoads module into sessionnot proof commands work against target
Version/pathImplementation identitydifferent versions can change behavior
Compatibility modeCross-edition bridgeproxy/serialization can change object behavior

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3046

Confirmation

Confirm action

Continue?