Table of Contents
Windows Package Manager
The winget command line tool enables users to discover, install, upgrade, remove and configure applications on Windows 10 and Windows 11 computers. This tool is the client interface to the Windows Package Manager service.
You can run Windows Package Manager on:
Install Windows Package Manager on on Windows LTSC
Microsoft suggests that you should use the Microsoft Store to get winget. However, this is not possible on Windows 10 LTSC, Windows 10 IoT, or Windows Server, because those operating systems do not have the Microsoft Store installed.
Without Microsoft Store, we can install winget manually using Windows PowerShell.
1. Open PowerShell or Terminal as administrator.
2. Download then install the require VCLibs dependency using Add-AppxPackage command. Assuming that you are running on a x64 OS. For reference, the above direct download link is from Microsoft’s C++ Runtime framework packages for Desktop Bridge documentation.
Add-AppxPackage "https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx"
3. Download and install the Windows UI Library dependency.
#Set path to store download files
New-Item -Path C:\Temp -ItemType Directory -Force
$path = "C:\Temp"
Set-Location $path
#Download and extract Nuget
$url = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
Invoke-WebRequest -URI $url -OutFile "$path/nuget.exe"
.\nuget.exe install Microsoft.UI.Xaml -Version 2.7
4. Winget introduced a new dependency for Microsoft.UI.Xaml.2.7 which you have to install manually. Extract the downloaded NuGet installer then install the package Microsoft.UI.Xaml.
Add-AppxPackage -Path "$path\Microsoft.UI.Xaml.2.7.0\tools\AppX\x64\Release\Microsoft.UI.Xaml.2.7.appx"
5. Download the latest version of WinGet from GitHub. Then using Add-AppxProvisionedPackge command to install the Windows Package Manager.
#Download winget and license file
function getLink($match) {
$uri = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"
$get = Invoke-RestMethod -uri $uri -Method Get -ErrorAction stop
$data = $get[0].assets | Where-Object name -Match $match
return $data.browser_download_url
}
$url = getLink("msixbundle")
$licenseUrl = getLink("License1.xml")
# Finally, install winget
$fileName = "winget.msixbundle"
Invoke-WebRequest -Uri $url -OutFile $fileName
$licenseName = "license1.xml"
Invoke-WebRequest -Uri $licenseUrl -OutFile $licenseName
Add-AppxProvisionedPackage -Online -PackagePath $fileName -LicensePath $licenseName
# Cleanup
Remove-Item $path\* -Recurse -Force
6. You can run the below command to verify the Winget is installed successfully.
$packages = @("Microsoft.VCLibs","DesktopAppInstaller","UI.Xaml")
ForEach ($package in $packages){Get-AppxPackage -Name *$package* | select Name,Version,Status }
Name Version Status
---- ------- ------
Microsoft.VCLibs.140.00.UWPDesktop 14.0.30704.0 Ok
Microsoft.DesktopAppInstaller 1.19.10173.0 Ok
Microsoft.UI.Xaml.2.7 7.2109.13004.0 Ok
After it is installed, you can access winget via the Windows Terminal, PowerShell, or the Command Prompt.
Combine all commands, you can copy and run at once or create a PowerShell script for later use.
#Install the dependency package
Add-AppxPackage "https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx"
#Set path to store download files
New-Item -Path C:\Temp -ItemType Directory -Force
$path = "C:\Temp"
Set-Location $path
#Download and install Microsoft.UI.Xaml
$url = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
Invoke-WebRequest -URI $url -OutFile "$path/nuget.exe"
.\nuget.exe install Microsoft.UI.Xaml -Version 2.7
Add-AppxPackage -Path "$path\Microsoft.UI.Xaml.2.7.0\tools\AppX\x64\Release\Microsoft.UI.Xaml.2.7.appx"
#Download winget and license file
function getLink($match) {
$uri = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"
$get = Invoke-RestMethod -uri $uri -Method Get -ErrorAction stop
$data = $get[0].assets | Where-Object name -Match $match
return $data.browser_download_url
}
$url = getLink("msixbundle")
$licenseUrl = getLink("License1.xml")
# Finally, install winget
$fileName = "winget.msixbundle"
Invoke-WebRequest -Uri $url -OutFile $fileName
$licenseName = "license1.xml"
Invoke-WebRequest -Uri $licenseUrl -OutFile $licenseName
Add-AppxProvisionedPackage -Online -PackagePath $fileName -LicensePath $licenseName
# Cleanup
Remove-Item $path\* -Recurse -Force
Install Windows Package Manager using script
Alternatively, if you don’t need to do it manually. You can use the below script for automatic installation.
1. Open PowerShell as administrator.
2. Copy and paste all below code into PowerShell window then hit Enter.
#Install a script from PSGallery
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
Install-PackageProvider -Name "NuGet" -Force
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
Install-Module -Name "PowerShellGet" -Force
Install-Script -Name "winget-install" -Force
winget-install.ps1
#Uninstall the script, we no longer need it
Uninstall-Script -Name "winget-install"