The essentials

Quick reference

One focused task per row. Jump to the related section for complete, working examples.

UseSyntaxExamples
Search packageswinget search --query 'PowerShell'View examples
Inspect an exact packagewinget show --id Microsoft.PowerShell --exact --source ` wingetView examples
List installed packageswinget listView examples
Find one installed IDwinget list --id Microsoft.PowerShell --exactView examples
Install exact packagewinget install --id Microsoft.PowerShell --exact ` --source wingetView examples
Request user scopewinget install --id Vendor.App --exact --scope userView examples
List upgradeswinget upgradeView examples
Upgrade one packagewinget upgrade --id Microsoft.PowerShell --exactView examples
Export package referenceswinget export --output '.\packages.json' ` --include-versionsView examples
Preview an importwinget import --import-file '.\packages.json' ` --ignore-unavailable --disable-interactivityView examples
Pin an installed packagewinget pin add --id Vendor.App --exactView examples
List sourceswinget source listView examples
Refresh sourceswinget source updateView examples
Open logs directorywinget --open-logsView examples

winget resolves application manifests from configured sources and delegates installers under declared scopes and modes. Use exact package IDs and source names, inspect manifests and agreements, review upgrade candidates, and remember that installer behavior can extend beyond package-manager metadata.

Step by step

Detailed examples

01

Resolve exact ID, version, architecture, and source

Display names are not unique and may change. Use search, then show with --id, --exact, and --source. Review publisher, installer type, URLs, hashes, scope, dependencies, and agreements; source trust and manifest validation do not make every installer risk-free.

Resolve PowerShell precisely
winget search --query 'PowerShell' --source winget
winget show --id Microsoft.PowerShell --exact --source winget
Back to quick reference ↑
02

Treat installed matching as an inventory hint

winget list correlates registry and package data with known manifests. Some applications may have unknown versions or no source match. Export results for comparison, but use organizational inventory and vulnerability tooling for compliance rather than assuming list is exhaustive.

Capture installed package inventory
winget list
winget list --id Microsoft.PowerShell --exact
winget list | Out-File -LiteralPath '.\winget-inventory.txt' -Encoding utf8
Back to quick reference ↑
03

Review installer impact before accepting automation

Install and upgrade may trigger elevation, UI, service changes, reboots, or custom exit codes. Request exact identity and scope, avoid blanket agreement flags until terms are approved, and test silent mode. Upgrade one critical package before broad upgrades.

Inspect then install one exact package
winget show --id Microsoft.PowerShell --exact --source winget
winget install --id Microsoft.PowerShell --exact --source winget
winget list --id Microsoft.PowerShell --exact
Back to quick reference ↑
04

Use export files as intent, not complete backups

Export records package references, not application data, configuration, licenses, or every installer. Inspect JSON and source identifiers before import. Versions may be unavailable later and installer behavior can change; keep application-specific backup and restore procedures.

Export and validate JSON
winget export --output '.\packages.json' --include-versions
Get-Content -LiteralPath '.\packages.json' -Raw | ConvertFrom-Json | Format-List
Back to quick reference ↑
05

Control upgrade policy and source trust

Pins affect winget upgrade selection but are not a security patch policy. Source additions expand trust and can introduce package-name ambiguity. Record source URL, type, owner, and approval; qualify commands by source and exact ID.

Inspect pins and sources
winget pin list
winget source list
winget source update
Back to quick reference ↑
06

Preserve command and installer diagnostics

winget errors may arise from source resolution, manifest applicability, download, elevation, or the installer itself. Capture client version, exact command, package ID, exit code, and logs. Do not rerun repeatedly with stronger privileges until the failure stage is known.

Capture baseline diagnostics
winget --version
winget source list
winget show --id Microsoft.PowerShell --exact --source winget
winget --open-logs
Back to quick reference ↑

Sources and further reading

References

Authoritative documentation used to verify and expand this cheat sheet.

  1. MicrosoftWindows Package Manager winget command-line toollearn.microsoft.com
  2. Microsoftwinget install commandlearn.microsoft.com
  3. Microsoftwinget upgrade commandlearn.microsoft.com
  4. Microsoftwinget source commandlearn.microsoft.com

Help us improve

Found a typo or missing example?

Tell us what would make this cheat sheet clearer, more complete, or more useful.

Share feedback