PowerShell Gallery¶
- ID
pwsh-gallery- Home page
- Version requirement
>= 7.4
- Platforms
🐧 Linux · 🍎 macOS · 🪟 Windows
- Operations
installed·outdated·search·install·upgrade·upgrade_all·remove- purl types
pkg:pwsh-gallery- CLI name
pwsh- Every call
pwsh -NoProfile -NonInteractive -Command <command>- Issues and PRs
- Source
PowerShell Gallery client, driven through the modern Microsoft.PowerShell.PSResourceGet module.
Note
Every operation is one PowerShell expression, run non-interactively
with no user profile loaded. Reads emit ConvertTo-Json -AsArray and
are parsed as JSON; outdated has no native cmdlet, so its
installed-versus-gallery comparison runs inside that single pwsh
call rather than as one round trip per installed module.
Note
Only pwsh (PowerShell 7+) is supported. Legacy Windows PowerShell 5.1
is intentionally excluded: it ships PowerShellGet v2, which depends on
the NuGet provider and prompts to trust PSGallery on first install.
PSResourceGet ships bundled with pwsh 7.4+ and supersedes the v2
cmdlets with cleaner, JSON-friendly objects.
Caution
All install and search operations target -Scope CurrentUser so that
mpm does not require elevation. upgrade and remove are scope-
agnostic and operate on whichever scope holds each module.
Caution
Install-PSResource is invoked with -TrustRepository so the
confirmation prompt on the default PSGallery repository is bypassed.
Only the default repository is consulted: third-party PSRepository
registrations are out of scope.
What mpm adds to pwsh-gallery¶
Through mpm, pwsh-gallery gains --extended search, to match against package descriptions.
Bigger still, mpm reaches across every manager at once: mpm installed and mpm outdated cover pwsh-gallery alongside every other manager you run in one table, mpm upgrade --all updates them together, and mpm sbom exports the whole machine as one bill of materials.
Every mpm command also gains --dry-run and --plan previews, cross-scheme version comparison and purl identifiers. See manager augmentations for how each one is built.
Your pwsh-gallery commands, in mpm¶
You already know pwsh-gallery: each operation maps one-to-one onto mpm, in an interface shared by every manager.
To… |
With |
With |
|---|---|---|
List what’s installed |
|
|
List outdated packages |
|
|
Search for a package |
|
|
Install a package |
|
|
Upgrade one package |
|
|
Upgrade everything |
|
|
Remove a package |
|
|
Prefix any command above with --dry-run to simulate the underlying manager calls without touching the system: the safe way to watch what mpm would do before trusting it.
Operations¶
Operation |
Supported |
Notes |
|---|---|---|
|
✓ |
|
|
✓ |
|
|
||
|
✓ |
extended search backfilled by |
|
✓ |
|
|
✓ |
|
|
✓ |
|
|
✓ |
|
|
||
|
||
|
Selecting and configuring pwsh-gallery¶
Deselect pwsh-gallery for a single run with --no-pwsh-gallery, or persist the choice in your configuration:
[mpm]
pwsh-gallery = false
The arguments and environment variables listed in the box atop this page are forced on every pwsh-gallery call, so runs stay quiet, non-interactive and reproducible: the defaults you would set in CI anyway.
Keep it enabled but tune how mpm drives it with a per-manager override:
[mpm.managers.pwsh-gallery]
timeout = 900
mpm config-template pwsh-gallery prints every overridable attribute as a ready-to-paste block.
Recipes¶
A few jobs you would otherwise script around pwsh-gallery, one mpm command each:
Snapshot and clone a machine:
mpm --pwsh-gallery dump pwsh-gallery.toml, thenmpm restore pwsh-gallery.tomlon the next one.Export a compliance SBOM:
mpm --pwsh-gallery sbom(CycloneDX by default,--spdxfor SPDX).
Privilege escalation¶
mpm runs this manager as the current user and never prepends sudo by default. Flip the policy for its privileged operations with --sudo or the per-manager sudo override.
See privilege escalation for the full policy.
Cooldown¶
State of PowerShell Gallery’s release-age gating, from the cooldown support table:
Status: ❌ None
A cooldown only pays off where a compromised release can be withdrawn while the clock runs, and can only be emulated where the registry dates its releases. From the retraction table:
Registry: PowerShell Gallery
Retraction: Yank under another name: the Gallery “does not support permanent deletion of packages”; an unlisted version leaves search and listings but “remains downloadable by specifying its exact version” (docs)
With --cooldown set, mpm skips this manager’s install and upgrade operations rather than run them unguarded (fail-closed); --allow-unsupported-managers opts back in.
Version probe¶
The version is probed by running:
$ pwsh --version
PowerShell 7.4.6
and extracted with:
r"PowerShell\s+(?P<version>\S+)"
Reference traces¶
Raw native outputs captured in the manager source: the reference mpm’s parsers were written against. If you know PowerShell Gallery well and a transcript below looks wrong, or a newer release changed its output format, report it.
$ pwsh -NoProfile -NonInteractive -Command \
"Get-InstalledPSResource | \
Select-Object Name, @{n='Version';e={$_.Version.ToString()}} | \
ConvertTo-Json -AsArray -Depth 2 -Compress"
[{"Name":"PSReadLine","Version":"2.3.6"},
{"Name":"Pester","Version":"5.5.0"}]
$ pwsh -NoProfile -NonInteractive -Command \
"Get-InstalledPSResource | ForEach-Object { ... } | \
ConvertTo-Json -AsArray -Depth 2 -Compress"
[{"Name":"PSReadLine","Installed":"2.3.4","Latest":"2.3.6"}]
Feed any of these through mpm and the raw output becomes one uniform table, the same shape for every manager: filter it, project columns, or export it (mpm --pwsh-gallery installed --output json, or csv, toml, yaml), each package carrying a purl and a version comparable across managers.