The essentials
Quick reference
One focused task per row. Jump to the related section for complete, working examples.
| Use | Syntax | Examples |
|---|---|---|
| List available module versions | Get-Module -ListAvailable Pester |
Sort-Object Version -Descending | View examples |
| List loaded modules | Get-Module | Sort-Object Name, Version | View examples |
| Inspect module search paths | $env:PSModulePath -split [IO.Path]::PathSeparator | View examples |
| List repositories | Get-PSResourceRepository | Sort-Object Priority, Name | View examples |
| Find exact resource | Find-PSResource -Name Pester -Version 5.6.1 -Repository `
PSGallery | View examples |
| List available versions | Find-PSResource -Name Pester -Version '*' -Repository PSGallery |
Sort-Object Version -Descending | View examples |
| Stage a module package | Save-PSResource -Name Pester -Version 5.6.1 -Repository `
PSGallery -Path './staging' | View examples |
| Validate a manifest | Test-ModuleManifest -Path `
'./staging/Pester/5.6.1/Pester.psd1' | View examples |
| Inspect script signatures | Get-ChildItem './staging/Pester' -Recurse -File -Include '*.ps1','*.psm1' |
Get-AuthenticodeSignature | View examples |
| Preview current-user install | Install-PSResource -Name Pester -Version 5.6.1 `
-Repository PSGallery -Scope CurrentUser -WhatIf | View examples |
| List installed resources | Get-InstalledPSResource -Name Pester |
Sort-Object Version -Descending | View examples |
| Preview module update | Update-PSResource -Name Pester -WhatIf | View examples |
| Import a pinned version | Import-Module -FullyQualifiedName @{ ModuleName = `
'Pester'; RequiredVersion = '5.6.1' } -ErrorAction `
Stop | View examples |
| Inspect exported commands | Get-Command -Module Pester | Sort-Object Name | View examples |
| Unload from session | Remove-Module -Name Pester -Force | View examples |
| Preview uninstall | Uninstall-PSResource -Name Pester -Version 5.6.1 -Scope `
CurrentUser -WhatIf | View examples |
PowerShell modules execute code with the caller's privileges, and repository priority can decide which publisher's package satisfies an unqualified name. Inventory installed and loaded versions separately, qualify repository and version, inspect manifests and staged package contents, and test upgrades in a fresh constrained environment. PSResourceGet is the current package-management interface; Windows PowerShell environments may still expose PowerShellGet v2 commands with different names and behavior.
Step by step
Detailed examples
Separate discoverable, installed, and loaded state
Get-Module reports the current session, while -ListAvailable searches PSModulePath. PSResourceGet inventory covers packages it manages and may not include modules copied manually or supplied by Windows. Multiple side-by-side versions are normal; command resolution can change when search paths, autoloading, or import order changes.
$env:PSModulePath -split [IO.Path]::PathSeparator
Get-Module -ListAvailable Pester | Select-Object Name, Version, Path
Get-Module Pester | Select-Object Name, Version, Path
Get-InstalledPSResource -Name Pester -ErrorAction SilentlyContinue Resolve by repository, name, and version
Repository trust suppresses prompts; it does not prove that every package or publisher is safe. A lower numeric priority has higher precedence in PSResourceGet, so unqualified lookups can select an unintended source. Review repository URI, ownership, TLS and authentication controls, then qualify critical automation by repository and a tested version range or exact version.
Get-PSResourceRepository | Sort-Object Priority, Name | Format-Table Name, Uri, Trusted, Priority, ApiVersion
Find-PSResource -Name Pester -Version 5.6.1 -Repository PSGallery | Select-Object Name, Version, Repository, Author, PublishedDate Stage and inspect before executing package code
Installation places code in a module search path, and importing it can execute module initialization. Save to a non-PSModulePath staging directory, inspect manifest-declared nested modules, scripts, dependencies, licenses, file hashes, and signatures, and scan with organizational controls. Test-ModuleManifest validates structure, not publisher intent or runtime safety.
Save-PSResource -Name Pester -Version 5.6.1 -Repository PSGallery -Path './staging'
Test-ModuleManifest -Path './staging/Pester/5.6.1/Pester.psd1'
Get-ChildItem './staging/Pester/5.6.1' -Recurse -File | Get-FileHash -Algorithm SHA256
Get-ChildItem './staging/Pester/5.6.1' -Recurse -File -Include '*.ps1','*.psm1' | Get-AuthenticodeSignature Install narrowly and treat updates as code changes
CurrentUser scope normally avoids elevation; AllUsers writes to shared locations and requires administrative rights. WhatIf previews supported package actions but cannot assess package runtime behavior. Pin versions in repeatable environments, review dependency changes, install into a test profile, and start a fresh PowerShell process before validating an upgraded module.
Install-PSResource -Name Pester -Version 5.6.1 -Repository PSGallery -Scope CurrentUser -WhatIf
Get-InstalledPSResource -Name Pester | Sort-Object Version -Descending
Update-PSResource -Name Pester -WhatIf Import explicitly and verify the resulting command surface
Installing does not load the new version into the current session. Existing modules and commands can remain bound until a new process starts. Use RequiredVersion for an exact pin; ModuleVersion is a minimum version. Add ErrorAction Stop and optionally Prefix or NoClobber when collision policy requires it. Then verify the loaded path, version, exported commands, and representative behavior.
Import-Module -FullyQualifiedName @{ ModuleName = 'Pester'; RequiredVersion = '5.6.1' } -ErrorAction Stop
Get-Module Pester | Select-Object Name, Version, Path
Get-Command -Module Pester | Sort-Object Name | Select-Object Name, CommandType, Source Diagnose resolution before removing anything
Import failures may result from edition compatibility, execution policy, missing dependencies, command collisions, architecture, or an unexpected path. Capture $PSVersionTable, module paths, available versions, and the full error first. Remove-Module only unloads this process; Uninstall-PSResource deletes files and can break other automation, so preview it and retain a reinstallable approved version.
$PSVersionTable
Get-Module -ListAvailable Pester | Select-Object Name, Version, Path
Get-Error -Newest 1
Remove-Module -Name Pester -Force -ErrorAction SilentlyContinue
Uninstall-PSResource -Name Pester -Version 5.6.1 -Scope CurrentUser -WhatIf Sources and further reading
References
Authoritative documentation used to verify and expand this cheat sheet.
Help us improve
Found a typo or missing example?
Tell us what would make this cheat sheet clearer, more complete, or more useful.



