Explore the Windows Package Manager tool
https://learn.microsoft.com/en-us/training/modules/explore-windows-package-manager-tool/
- winget is an open source tool to install/uninstall software from the Windows command line
- Targeting B2C and B2B
- Supports Windows 10, 11, and Server
Explain the purpose of Windows Package Manager
Section titled “Explain the purpose of Windows Package Manager”- A package represents an application
- A manifest is a (set of) metadata file(s) that instruct winget on how to (un)install a package
- A source is a repository containing manifests
- Sources that are enabled by default (but can be disabled through group policy):
msstore- apps (without age restriction) from the Microsoft Storewinget- a community repository curated by volunteers and secured by Microsoft (similar to the AUR for Arch Linux)
- Organizations can host their own sources, which are based on a REST API
Install and uninstall software with Windows Package Manager
Section titled “Install and uninstall software with Windows Package Manager”- Search for a package:
Terminal window winget search SEARCH_TERM - Install a package:
Terminal window winget install PACKAGE_ID - CLI flags can be used to install from a local manifest, force installation by ID only, only search the name, specify a specific version to install, install quietly, and more.
- Uninstall a package:
Terminal window winget uninstall PACKAGE_ID
Update software with Windows Package Manager
Section titled “Update software with Windows Package Manager”- List available updates:
Terminal window winget upgrade - Upgrade one package:
Terminal window winget upgrade PACKAGE_ID - Upgrade all packages with updates:
Terminal window winget upgrade --all
Discuss the Windows Package Manager repository
Section titled “Discuss the Windows Package Manager repository”- The Windows Package Manager Community Repository is a source that everyone can contribute to.
- Manifests are in YAML format.
- A source has the following directory structure:
manifests / m / Microsoft / PowerShell / 7.1.4.0Where:manifestsis always the same static name for the top level directorymis the lower-cased first letter of the publisher nameMicrosoftis the publisherPowerShellis the application7.1.4.0is the version
- The publisher, application and version directories each store relevant metadata.
Contribute to the Windows Package Manager repository
Section titled “Contribute to the Windows Package Manager repository”- Requirements for contributing packages:
- A GitHub account
- The installer needs to be in MSIX, MSI or EXE format
- Not a duplicate
- microsoft/winget-create - Windows Package Manager Manifest Creator CLI
- Create a new package:
Terminal window wingetcreate new INSTALLER_URL_1 INSTALLER_URL_2 ...- Only one URL is required, but there could be multiple, e.g. for different architectures (x64 vs. arm64, etc.)
- The schema supports “singleton” manifests (all metadata in one file), but
wingetcreatecreates multi-file manifests, and those are the only ones accepted by the community repository
- Create a new package:
- The
PACKAGE_ID.installer.yamlsupports specifyingInstallerSwitches, e.g. for silent installation - Packages can be “tagged” to be discoverable using miscellaneous search terms
- Validate a manifest:
Terminal window winget validate -manifest MANIFEST_PATH - Test-install a manifest:
Terminal window winget install -manifest MANIFEST_PATH - “Windows Sandbox” is a disposable VM in Windows 11 Pro and higher editions that can simplify testing installers
- Store a GitHub token to allow
wingetcreateto open pull requests for package contributions:Terminal window wingetcreate -store GITHUB_PAT_TOKEN - Open a pull request from
wingetcreate(this automatically forks the community repository in the user’s GitHub account):Terminal window wingetcreate submit MANIFEST_PATH
Host your own Windows Package Manager repository
Section titled “Host your own Windows Package Manager repository”- microsoft/winget-cli-restsource - a reference implementation of a REST based package source for the winget client
- Use group policy to configure installer source repositories available to enterprise users
Control Windows Package Manager with Group Policy
Section titled “Control Windows Package Manager with Group Policy”- A group policy template in the ADMX/ADML format can be downloaded here.
- Users can see the applied policies using:
Terminal window winget --info - Using group policy, enterprise administrators can configure:
- Whether Windows Package Manager is enabled
- If users may change their settings
- Whether hashes can be overridden
- The ability to enable experimental features
- Local manifest installation
- The auto update interval for sources
- The default source (the community repository)
- The Microsoft Store source
- Whether users can add sources
- Which sources users can enable/disable, if any