Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Modules · PowerShell Automation

Direct 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.

When to use this

Use this when packaging or installing PowerShell modules.

First 30 seconds

1. Modules package functions (psm1, psd1 manifest).

2. Pin versions.

3. Trusted repositories (PSGallery, internal).

4. Sign modules for production.

5. Export only public functions.

Operational verification

module → manifest → imported commands

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
PowerShell 7.5/current
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformPowerShell 7.5/current · Automation implementations are tool and platform specific. Use the adjacent Domain for the technology being automated and this Domain for automation behavior.
Scope / prerequisiteUse this when packaging or installing PowerShell modules.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

3 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Verification path Verify boundary

Use Get-Module -ListAvailable to inventory installed versions, Import-Module -PassThru to show the version actually loaded, and Get-Command -Module <name> or Get-Command <name> -All to verify exported command resolution. After module updates, create a fresh runspace/process so already-loaded assemblies or classes do not mask version behavior.

Step 2 Common mistakes Narrow the fault
  • Module versions not pinned.
Step 3 Where it fails Narrow the fault

Module auto-loading is convenience, not dependency control. Updating module files under a running session may not replace loaded types/assemblies, and removing a module may not fully undo side effects. Separate installation inventory, module resolution, imported runtime state, exported command identity and target operation results.

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Modules package functions (.psm1) with a manifest (.psd1).
  • Install-Module installs from the PowerShell Gallery.
  • Pin versions with -RequiredVersion.
Key checks
  • Get-Module -ListAvailable <name> — installed
  • Install-Module <name> -Scope CurrentUser — install (PSGallery)
  • Import-Module <name> -RequiredVersion <v> — pin version
ReferenceWhy it matters1 section · depth on demand

In depth

A PowerShell module packages functions, variables and resources into a unit that can be versioned, shared and imported. Modules turn collections of scripts into maintainable tooling, and are the format for publishing to the PowerShell Gallery or an internal repository.

NetOps/
  NetOps.psd1        # manifest: version, exported functions, dependencies
  NetOps.psm1        # loads Public/ and Private/
  Public/Get-SwitchInventory.ps1
  Private/Invoke-NetboxApi.ps1
  Tests/NetOps.Tests.ps1
New-ModuleManifest .\NetOps\NetOps.psd1 -RootModule NetOps.psm1 -ModuleVersion 1.2.0 -FunctionsToExport 'Get-SwitchInventory'
Import-Module .\NetOps -Force
Publish-Module -Path .\NetOps -Repository Internal

Export only public functions, declare required modules in the manifest, and test with Pester before publishing.

ReferenceImportant terms & boundaries1 section · depth on demand

PowerShell mechanics

PowerShell modules package commands, types, format data and other resources behind a module identity and version. Discovery searches locations such as $env:PSModulePath; autoload can import a module when a command is first used, and multiple installed versions can create command-resolution ambiguity. Manifest metadata, nested modules and exported members shape the public surface seen by automation.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
ReferenceConfiguration & state1 section · depth on demand

Authoring and lifecycle

Treat module dependencies as deployable prerequisites: pin or constrain versions where compatibility matters, use manifests for reusable code, and avoid relying on whichever version happens to be first on PSModulePath. Import into controlled sessions and record version/source. For internal modules, version and test the public command contract before rollout.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docPowerShell 7.5/current 7.5/current

Microsoft Learn documentation reviewed for bounded PowerShell reference claims. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://learn.microsoft.com/en-us/powershell/scripting/developer/module/importing-a-powershell-module?view=powershell-7.5 · confidence 94%
Embedded reference data

Quick lookup tables

Modules · PowerShell operational reference

Topic-specific PowerShell runtime identity, persistence, verification, output and failure-boundary lookup.

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
Depth when you need it

Deep reference

Healthy vs suspicious evidence

Output interpretation

Installed, discoverable and imported are different states. The filesystem can contain multiple versions while one version is loaded, and command shadowing can select a function/alias from elsewhere. A successful module import only shows initialization, but it does not show downstream services or credentials are available.

Confirmation

Confirm action

Continue?