Pcornel
Automation · PowerShell Automation

Modules

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

Back to the Topic

Answer

PowerShell modules package functions, cmdlets and resources (.psm1 with a .psd1 manifest), installed from the PowerShell Gallery with Install-Module and loaded with Import-Module.

Remember

  • Modules package functions (.psm1) with a manifest (.psd1).
  • Install-Module installs from the PowerShell Gallery.
  • Pin versions with -RequiredVersion.

First checks

  • Get-Module -ListAvailable <name> — installed
  • Install-Module <name> -Scope CurrentUser — install (PSGallery)
  • Import-Module <name> -RequiredVersion <v> — pin version

Verify in this order

module → manifest → imported commands

Where it usually breaks

Script/input → command/module binding → local/remoting session → request accepted → command result → target object read-back → effective runtime state → workload.

Modules · PowerShell operational reference

BoundaryModules reference
Runtime identityPowerShell edition/version + command/module source
Persistent intentScript/module/config prerequisites under source control
VerificationRead-only discovery → execution evidence → independent target read-back
Output contractStructured objects/streams before formatting
Failure boundarySeparate engine/binding from transport/API/native and target-state failures

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

Confirmation

Confirm action

Continue?