Modules
Cheat sheet · https://pcornel.dk/topic.php?topic=3046
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.
PSModulePathand 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 versionGet-Command <name>— which cmdlet/function/exe runsGet-Help <cmdlet> -Full— syntax and parametersGet-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
| Item | Meaning | Evidence boundary |
|---|---|---|
| Discovery | Module found on search path | not proof it can import |
| Manifest | Metadata/dependencies/compatibility | metadata can be incomplete or environment-specific |
| Import | Loads module into session | not proof commands work against target |
| Version/path | Implementation identity | different versions can change behavior |
| Compatibility mode | Cross-edition bridge | proxy/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