codeworking.org
Search
Developer Skill / Gist

Deep Dive into WinGet

Modern Windows Tooling: WinGet (Windows Package Manager) is Microsoft’s official, open-source command-line client designed to discover, install, upgrade, configure, and remove software across Windows 10, Windows 11, and Windows Server. Seamlessly integrated into the operating system via the App Installer, WinGet turns manual .exe and .msi installations into automated, reproducible scripts.


1. What is WinGet? Origin & Core Architecture

For decades, software management on Windows relied on manual browser downloads, setup wizard clicking, and third-party tools like Chocolatey and Scoop. In May 2020, Microsoft introduced the Windows Package Manager (winget-cli), an official, native, and cryptographically verified package manager built for modern developer workflows and enterprise management.

+-----------------------------------------------------------------------+
|                           WinGet Client (winget.exe)                  |
+-----------------------------------------------------------------------+
        |                                    |                    |
        v                                    v                    v
+-------------------+              +-------------------+  +-------------+
|  winget Source    |              |  msstore Source   |  | Custom REST |
| (Community Repo)  |              | (Microsoft Store) |  |   Sources   |
+-------------------+              +-------------------+  +-------------+
        |                                    |                    |
        +------------------+-----------------+--------------------+
                           |
                           v
+-----------------------------------------------------------------------+
|                     Windows Installer Engine                          |
| (MSIX / AppX / MSI / EXE / InnoSetup / Nullsoft / Portable Binaries)  |
+-----------------------------------------------------------------------+

Core Architectural Pillars

  1. App Installer Integration: WinGet is distributed as part of the official Windows App Installer package (Microsoft.DesktopAppInstaller) and receives automatic zero-touch updates through the Microsoft Store.
  2. Multi-Source Ecosystem:
    • winget (Community Repository): A community-curated GitHub repository (microsoft/winget-pkgs) hosting tens of thousands of validated YAML manifests for open-source and proprietary desktop software.
    • msstore (Microsoft Store): Direct CLI access to Modern Windows Store applications and MSIX packages.
    • Enterprise Custom REST Sources: Private internal registries hosted on Azure, GitHub, or intranet servers for enterprise software distribution.
  3. Format Agnostic: Natively handles MSI, MSIX, EXE (Inno Setup, NSIS, InstallShield, WiX, Burn), and standalone portable .zip/.exe binaries without requiring developers to repackage their software.
  4. Cryptographic Validation: Enforces mandatory SHA-256 hash checking on every installer download to prevent supply-chain tampering and man-in-the-middle attacks.

2. Installation & Verification

WinGet is pre-installed out of the box on:

  • Windows 11 (all versions)
  • Windows 10 (Build 17763 / Version 1809 and newer)

Checking Your Environment

Open PowerShell or Windows Terminal and run:

# Check installed WinGet version
winget --version

# View system diagnostic info, paths, and configured sources
winget --info

Manual Installation & Updates

If WinGet is missing (e.g. on clean Windows Server images or LTSC builds):

  1. Microsoft Store: Install or update the App Installer app from the Microsoft Store.
  2. PowerShell CLI:
    # Install App Installer via PowerShell
    Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe
  3. GitHub Direct Binary: Download the latest .msixbundle from the official microsoft/winget-cli Releases.

3. Command-Line Mastery: Daily Workflows

3.1 Searching & Inspecting Software

Search the package index using keywords, names, or tags:

# Search for packages matching "git"
winget search git

# Search by exact package ID
winget search --id Git.Git

# Inspect full metadata, description, license, and installer URLs
winget show Git.Git

3.2 Installing Software

Install applications by their unique, unambiguous Package ID:

# Standard interactive installation
winget install --id Microsoft.VisualStudioCode

# Silent, non-interactive background installation
winget install --id Git.Git --silent

# Accept software and source license agreements automatically (ideal for scripts)
winget install --id OpenJS.NodeJS --accept-package-agreements --accept-source-agreements

# Machine-wide installation (Program Files) vs Current User scope
winget install --id Mozilla.Firefox --scope machine
winget install --id JanDeDobbeleer.OhMyPosh --scope user

# Specify custom installation directory
winget install --id Python.Python.3.13 --location "C:\Dev\Python313"

# Target specific CPU architecture (x64, x86, arm64)
winget install --id Microsoft.DotNet.SDK.9 --architecture x64

3.3 Listing Installed Applications & Upgrading

WinGet detects software installed both through WinGet and traditional external installers:

# List all software installed on the machine
winget list

# Check which installed packages have available updates
winget upgrade

# Upgrade a specific package
winget upgrade --id Microsoft.VisualStudioCode

# Upgrade ALL installed software in one command
winget upgrade --all --include-unknown --accept-package-agreements --accept-source-agreements

3.4 Uninstalling Applications

# Uninstall an application cleanly
winget uninstall --id Docker.DockerDesktop

# Silent uninstall
winget uninstall --id Zoom.Zoom --silent

4. Reproducible Environments: Infrastructure-as-Code for Windows

One of WinGet’s most powerful capabilities is Infrastructure-as-Code (IaC) for workstation setup. You can export an entire machine’s software inventory into a declarative JSON file and restore it on any new machine with a single command.

[Developer Machine A] ──> winget export -o dev-stack.json ──> (Git Repo / Cloud)

[Fresh Machine B]     <── winget import -i dev-stack.json <───────────┘

Exporting Your Software Stack

# Export all installed applications into a portable configuration file
winget export -o "$HOME\Documents\dev-environment.json"

# Export with pinned specific versions
winget export -o "$HOME\Documents\dev-environment-pinned.json" --include-versions

Example dev-environment.json Manifest

{
  "$schema": "https://aka.ms/winget-packages.schema.2.0.json",
  "CreationDate": "2026-08-21T10:00:00.000Z",
  "Sources": [
    {
      "Packages": [
        { "PackageIdentifier": "Git.Git" },
        { "PackageIdentifier": "Microsoft.VisualStudioCode" },
        { "PackageIdentifier": "OpenJS.NodeJS.LTS" },
        { "PackageIdentifier": "Oven-sh.Bun" },
        { "PackageIdentifier": "Docker.DockerDesktop" },
        { "PackageIdentifier": "Microsoft.WindowsTerminal" },
        { "PackageIdentifier": "JanDeDobbeleer.OhMyPosh" },
        { "PackageIdentifier": "7zip.7zip" }
      ],
      "SourceDetails": {
        "Argument": "https://cdn.winget.microsoft.com/cache",
        "Identifier": "Microsoft.Winget.Source_8wekyb3d8bbwe",
        "Name": "winget",
        "Type": "Microsoft.PreIndexed.Package"
      }
    }
  ]
}

Importing & Provisioning a Fresh Machine

On a new laptop or freshly formatted PC:

winget import -i "$HOME\Documents\dev-environment.json" --accept-package-agreements --accept-source-agreements --ignore-unavailable

💡 Automation Tip: The --ignore-unavailable flag ensures that if any single legacy utility is temporarily unavailable, the installation process continues smoothly for all remaining tools without halting.


5. Version Pinning: Preventing Unwanted Upgrades

In production development, certain toolchains (e.g. database servers, specific Java SDKs, or legacy drivers) must stay locked to a specific version. WinGet provides native package pinning:

# Pin a package to prevent 'winget upgrade --all' from touching it
winget pin add --id Oracle.JDK.21 --blocking

# Pin a package to a specific minor release track
winget pin add --id Python.Python.3.11 --version "3.11.*"

# List all active pins
winget pin list

# Remove a pin when you are ready to upgrade
winget pin remove --id Oracle.JDK.21

6. WinGet Configuration & DSC: Declarative Workstations

WinGet supports PowerShell Desired State Configuration (DSC) and declarative YAML configuration files (winget configure). This allows teams to configure not just software installation, but Windows OS settings, Developer Mode, WSL distributions, and VS Code extensions in one file.

Example configuration.yaml

# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
properties:
  configurationVersion: 0.2.0
  resources:
    # 1. Install Developer Tooling via WinGet
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: install-git
      directives:
        description: Install Git SCM
        allowPrerelease: true
      settings:
        id: Git.Git
        source: winget

    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: install-vscode
      directives:
        description: Install Visual Studio Code
      settings:
        id: Microsoft.VisualStudioCode
        source: winget

    # 2. Enable Windows Developer Mode
    - resource: Microsoft.Windows.Developer/DeveloperMode
      id: enable-dev-mode
      directives:
        description: Enable Windows Developer Mode
      settings:
        Ensure: Present

Executing Declarative Configuration

# Validate and test the configuration without applying
winget configure test configuration.yaml

# Apply the declarative state to the machine
winget configure configuration.yaml --accept-configuration-agreements

7. Ecosystem Comparison: WinGet vs Chocolatey vs Scoop vs Homebrew

Feature WinGet (Windows) Chocolatey (Windows) Scoop (Windows) Homebrew (macOS/Linux)
Official Backing Microsoft (First-Party) Third-Party Community Third-Party Community Community / Open Source
OS Integration Native (App Installer) Requires PowerShell Bootstrapping Requires PowerShell Bootstrapping Terminal / Shell Script
Installation Scope Machine & User scopes Machine-wide primarily User-space (Portable /shims) User (/opt/homebrew or /usr/local)
Manifest Format Clean YAML with SHA-256 NuGet .nupkg & PowerShell JSON manifests Ruby formulas
Store Access Microsoft Store + WinGet Repo Chocolatey Community Repo Scoop Buckets Homebrew Core & Cask
Security Scanning Microsoft SmartScreen & VirusTotal Community moderation Git PR review Git PR review
Declarative Config Built-in DSC (winget configure) Chocolatey Central Mgmt ($) Custom scripts Brewfile (brew bundle)
UAC Elevation Prompts standard Windows UAC Requires Admin Terminal No Admin required No sudo recommended

8. Enterprise Deployment & Administration

Group Policy (GPO) Governance

Enterprise administrators can manage WinGet across thousands of domain-joined devices using official ADMX/ADML administrative templates:

  • Disable WinGet: Prevent non-admin software installations.
  • Source Restriction: Restrict downloads exclusively to internal private enterprise REST sources while blocking public community sources.
  • Bypass Hash Checks: Configurable security enforcement tiers.

Managing Sources

# List active package sources
winget source list

# Add an internal enterprise repository
winget source add --name "CorporateSoftware" --arg "https://packages.internal.corp/winget" --type "Microsoft.Rest"

# Reset default community sources if corrupted
winget source reset --force

9. Essential Troubleshooting Guide

Problem Cause Solution
winget: command not found PATH not loaded or App Installer missing Re-register App Installer via PowerShell: Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe or restart terminal.
Installer Hash Mismatch (0x80070057) Upstream vendor updated the installer binary before manifest was synced Run winget source update. If still failing, install with --ignore-security-hash (use with caution) or submit an updated manifest via wingetcreate.
UAC / Permission Denied Installer requires administrative rights Open Windows Terminal as Administrator or specify --scope user if the software supports per-user installation.
0x8a15000f: Data required by the source is missing Local source cache is out of date or corrupted Execute winget source reset --force followed by winget source update.

10. Summary & Cheat Sheet

# 🔍 Search & Inspect
winget search <name>
winget show <id>

# 📦 Install & Manage
winget install --id <id> --silent --accept-package-agreements --accept-source-agreements
winget list
winget upgrade --all
winget uninstall --id <id>

# 📌 Version Control
winget pin add --id <id> --blocking
winget pin list
winget pin remove --id <id>

# 💾 Workstation Portability (IaC)
winget export -o dev-stack.json
winget import -i dev-stack.json --accept-package-agreements --accept-source-agreements
winget configure configuration.yaml

WinGet provides a clean, unified, enterprise-grade package management foundation for the modern Windows development ecosystem.

S

Computer Science educator, Software Engineer, Cloud Computing & Cloud Native Architect, and AI/ML Engineer. Founder & Owner of unus.one, softwork.ing, and codeworking.org.

Comments & Discussion