Skip to content

Bring Pinning to PowerShell Cmdlets#6190

Open
Trenly wants to merge 8 commits intomicrosoft:masterfrom
Trenly:PinPlus
Open

Bring Pinning to PowerShell Cmdlets#6190
Trenly wants to merge 8 commits intomicrosoft:masterfrom
Trenly:PinPlus

Conversation

@Trenly
Copy link
Copy Markdown
Contributor

@Trenly Trenly commented Apr 29, 2026

Summary

This PR extends the WinGet pinning system with new metadata, a new CLI subcommand, expanded COM API surface, and PowerShell cmdlets for managing pins.

CLI Changes

  • winget pin add: Added --note argument to attach an optional freeform note to a pin. The timestamp when a pin is created is now recorded automatically.
  • winget pin show: New subcommand that displays detailed information about pins for a specific package (query by ID, name, or keyword).

Pinning Index Schema (v1.1)

  • New schema version adds DateAdded and Note columns to the pin table to persist the new metadata.

COM API (Microsoft.Management.Deployment, contract v30)

  • PackageManager.GetAllPins() — retrieve all pins across all sources.
  • PackageManager.GetPins(CatalogPackage) — retrieve pins for a specific package.
  • PackageManager.PinPackage(CatalogPackage, PinPackageOptions) — add or update a pin.
  • PackageManager.UnpinPackage(CatalogPackage) — remove all pins for a package.
  • PackageManager.ResetAllPins(String sourceName) — reset all pins, optionally scoped to a source.
  • New PackagePin runtime class exposing PackageId, SourceId, Type, GatedVersion, DateAdded, Note, and IsForInstalledPackage.
  • New PinPackageOptions and PinPackageResult runtime classes.
  • New PackagePinType enum (PinnedByManifest, Pinning, Gating, Blocking).

PowerShell (Microsoft.WinGet.Client)

  • Add-WinGetPin — pin a package with a specified pin type, optional gated version, note, and force flag.
  • Get-WinGetPin — list pins, filterable by package/source.
  • Remove-WinGetPin — remove pins for a package.
  • Reset-WinGetPin — reset all pins, optionally scoped to a source.
  • Get-WinGetPackage — new IsPinned property on returned objects.

cc @denelon for Naming


Microsoft Reviewers: Open in CodeFlow

@Trenly Trenly marked this pull request as ready for review April 29, 2026 20:22
@Trenly Trenly requested a review from a team as a code owner April 29, 2026 20:22
@denelon
Copy link
Copy Markdown
Collaborator

denelon commented Apr 29, 2026

Were you able to figure out the PlatyPS MAML stuff for the PowerShell help?

@Trenly
Copy link
Copy Markdown
Contributor Author

Trenly commented Apr 29, 2026

Were you able to figure out the PlatyPS MAML stuff for the PowerShell help?

Get-Help seems to work the same way for the new cmdlets as it does for the others. I might look at improving the PowerShell help separately in the future. This PR is already bigger than I'm sure John might like it to be, don't want to make anyone too frazzled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants