Table of contents
  1. WingetCLI
  2. Installing
    1. PowerShell
      1. Get the download URL of the latest winget installer from GitHub:
      2. Download the installer:
      3. Install winget:
      4. Remove the installer:
    2. PowerShell 7+
    3. Quick Scripts
      1. Install Command
        1. Options
      2. Upgrade
      3. Uninstall
        1. Options
      4. Find software to install
      5. Browse a Windows Package Manage repository
  3. NuGet
    1. Install
      1. Using dotnet CLI
  4. Chocolatey




WingetCLI

Installing

PowerShell

Get the download URL of the latest winget installer from GitHub:

$API_URL = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"
$DOWNLOAD_URL = $( Invoke-RestMethod $API_URL ).assets.browser_download_url |
        Where-Object { $_.EndsWith(".msixbundle") }

Download the installer:

Invoke-WebRequest -URI $DOWNLOAD_URL -OutFile winget.msixbundle -UseBasicParsing

Install winget:

Add-AppxPackage winget.msixbundle

Remove the installer:

Remove-Item winget.msixbundle

If you get an error that the framework “Microsoft.UI.Xaml.2.7” could not be found, then you can use the following commands to install it:

    Invoke-WebRequest `
      -URI https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/2.7.3 `
      -OutFile xaml.zip -UseBasicParsing
    New-Item -ItemType Directory -Path xaml
    Expand-Archive -Path xaml.zip -DestinationPath xaml
    Add-AppxPackage -Path "xaml\tools\AppX\x64\Release\Microsoft.UI.Xaml.2.7.appx"
    Remove-Item xaml.zip
    Remove-Item xaml -Recurse

If you then get another error that the framework “Microsoft.VCLibs.140.00.UWPDesktop” could not be found, then you can additionally use the
following commands to install it:

    Invoke-WebRequest `
        -URI https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx `
        -OutFile UWPDesktop.appx -UseBasicParsing
    Add-AppxPackage UWPDesktop.appx
    Remove-Item UWPDesktop.appx

Then, repeat the initial commands

Once you have followed the above steps, you can use winget on the command line. For example, to update PowerShell:

    winget install --id Microsoft.Powershell --source winget

Remember to again run this with administrative privileges. If you want to execute it in PowerShell itself, prefix the line with an ampersand &

PowerShell 7+

A prerelease version of the Microsoft.WinGet.Client PowerShell module has been published to the PowerShell Gallery and will no longer be
included as a release asset.
To install the
latest version of the PowerShell module, run the following command in PowerShell 7+

Install-Module -Name Microsoft.WinGet.Client

The PowerShell module requires App Installer (winget) to be installed. The Repair-WinGetPackageManager cmdlet (work in progress) is designed to
install or repair App Installer

Quick Scripts

Install Command

Logitech Package Repo

winget install --id Logitech.UnifyingSoftware --force --accept-package-agreements --accept-source-agreements -h -l "C:\Users\Brandon003842\LogiTech"

install multiple pieces of software

winget install Microsoft.AzureStorageExplorer; winget install Microsoft.VisualStudioCode; winget install Microsoft.AzureCLI

Options

OptionDescription
-m, –manifestMust be followed by the path to the manifest (YAML) file. You can use the manifest to run the install experience from a local YAML file.
–idLimits the install to the ID of the application.
–nameLimits the search to the name of the application.
–monikerLimits the search to the moniker listed for the application.
-v, –versionEnables you to specify an exact version to install. If not specified, latest will install the highest versioned application.
-s, –sourceRestricts the search to the source name provided. Must be followed by the source name.
–scopeAllows you to specify if the installer should target user or machine scope.
-e, –exactUses the exact string in the query, including checking for case-sensitivity. It will not use the default behavior of a substring.
-i, –interactiveRuns the installer in interactive mode. The default experience shows installer progress.
-h, –silentRuns the installer in silent mode. This suppresses all UI. The default experience shows installer progress.
–localeSpecifies which locale to use (BCP47 format).
-o, –logDirects the logging to a log file. You must provide a path to a file that you have the write rights to.
–overrideA string that will be passed directly to the installer.
-l, –locationLocation to install to (if supported).
–forceOverrides the installer hash check. Not recommended.

Upgrade

winget upgrade --all --include-unknown

Uninstall

winget uninstall Microsoft.AzureStorageExplorer

Options

OptionDescription
-m, –manifestMust be followed by the path to the manifest (YAML) file. You can use the manifest to run the uninstall experience from a local YAML file.
–idLimits the uninstall to the ID of the application.
–nameLimits the search to the name of the application.
–monikerLimits the search to the moniker listed for the application.
-v, –versionEnables you to specify an exact version to uninstall. If not specified, latest will uninstall the highest versioned application.
-s, –sourceRestricts the search to the source name provided. Must be followed by the source name.
-e, –exactUses the exact string in the query, including checking for case-sensitivity. It will not use the default behavior of a substring.
-i, –interactiveRuns the uninstaller in interactive mode. The default experience shows uninstaller progress.
-h, –silentRuns the uninstaller in silent mode. This suppresses all UI. The default experience shows uninstaller progress.
-o, –logDirects the logging to a log file. You must provide a path to a file that you have the write rights to.
–localeSpecifies which locale to use (BCP47 format).
-o, –logDirects the logging to a log file. You must provide a path to a file that you have the write rights to.
–overrideA string that will be passed directly to the installer.
-l, –locationLocation to install to (if supported).
–forceOverrides the installer hash check. Not recommended.

Find software to install

winget search

Browse a Windows Package Manage repository

manifests / m / Microsoft / PowerShell / 7.1.4.0

NuGet

Install

Using dotnet CLI

Chocolatey

install using nuget