Update: the easiest current method is to use the community
winget-installscript from PowerShell Gallery. This script installs WinGet and required dependencies automatically.
Run the following from an elevated PowerShell session:
Install-Script -Name winget-install -Force
winget-install -ForceAfter installation, open a new PowerShell session and verify:
winget --infoNotes:
Install-Script -Name winget-install -Forceinstalls or updates the helper script from PowerShell Gallery.winget-install -Forceruns the installer and forces the install/repair flow even if WinGet appears to be present already.- You may be prompted to install the NuGet provider or trust PowerShell Gallery the first time.
- For production, restricted, or offline environments, review the script and consider mirroring/pinning it through your own trusted repository before use.
The manual method below is kept as a fallback for environments where PowerShell Gallery access is unavailable or where third-party scripts are not allowed.
Use this method if you do not want to use a third-party helper script, or if PowerShell Gallery access is not available.
Run this from Windows PowerShell as Administrator. PowerShell 7 is not recommended for this flow because the Appx cmdlets are Windows PowerShell cmdlets.
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$WorkDir = Join-Path $env:TEMP 'winget-install'
$DepsDir = Join-Path $WorkDir 'DesktopAppInstaller_Dependencies'
New-Item -ItemType Directory -Force -Path $WorkDir | Out-Null
## Get latest stable WinGet release from GitHub
$Release = Invoke-RestMethod -Uri 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
$MsixBundle = $Release.assets |
Where-Object { $_.name -eq 'Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle' } |
Select-Object -First 1
$DependenciesZip = $Release.assets |
Where-Object { $_.name -eq 'DesktopAppInstaller_Dependencies.zip' } |
Select-Object -First 1
$LicenseFile = $Release.assets |
Where-Object { $_.name -like '*_License1.xml' } |
Select-Object -First 1
if (-not $MsixBundle -or -not $DependenciesZip -or -not $LicenseFile) {
throw 'Could not find all required WinGet release assets.'
}
$MsixBundlePath = Join-Path $WorkDir 'Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle'
$DependenciesZipPath = Join-Path $WorkDir 'DesktopAppInstaller_Dependencies.zip'
$LicensePath = Join-Path $WorkDir 'license.xml'
## Download WinGet, dependencies, and license
Invoke-WebRequest -Uri $MsixBundle.browser_download_url -OutFile $MsixBundlePath
Invoke-WebRequest -Uri $DependenciesZip.browser_download_url -OutFile $DependenciesZipPath
Invoke-WebRequest -Uri $LicenseFile.browser_download_url -OutFile $LicensePath
## Extract and install dependencies
Expand-Archive -Path $DependenciesZipPath -DestinationPath $DepsDir -Force
## Windows Server 2022 is normally x64. Adjust if needed for another architecture.
$Architecture = 'x64'
$DependencyPath = Join-Path $DepsDir $Architecture
Get-ChildItem -Path $DependencyPath -File |
Where-Object { $_.Extension -in '.appx', '.msix' } |
ForEach-Object {
Add-AppxPackage -Path $_.FullName
}
## Provision App Installer / WinGet
Add-AppxProvisionedPackage -Online -PackagePath $MsixBundlePath -LicensePath $LicensePath
## Register the package for the current user if winget is not immediately available
Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe
## Verify
winget --info

