Skip to content

Instantly share code, notes, and snippets.

@erwinkersten
Last active November 27, 2025 02:42
Show Gist options
  • Select an option

  • Save erwinkersten/626ed456c1bd84fd5e023b081d6d450e to your computer and use it in GitHub Desktop.

Select an option

Save erwinkersten/626ed456c1bd84fd5e023b081d6d450e to your computer and use it in GitHub Desktop.
Install WIndows Package Manager (winget) on Windows Server 2022

Install WIndows Package Manager (winget) on Windows Server 2022

  1. Download and install microsoft-ui-xaml
  2. Download WinGet an License file
  3. Install WinGet with License

Execute the following in Windows PowerShell (PowerShell 7 doesn't support the Appx module)

#Update versions, see https://github.com/microsoft/microsoft-ui-xaml/releases (grab Microsoft.UI.Xaml Winget may require a specific version) 
Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -outfile Microsoft.UI.Xaml.appx
Add-AppxPackage -Path .\Microsoft.UI.Xaml.appx

# Select the Winversion you want to install, see https://github.com/microsoft/winget-cli/releases
# set the version with $env:WinGetVer

$env:WinGetVer=1.8.1911 

# Download License file, With version bump also update the license file name (see assets)
Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/download/v$env:WinGetVer/fb2830f66c95424aa35457b05e88998a_License1.xml -outfile license.xml


# Download Winget, version bump update als the msixbundle file
Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/download/v$env:WinGetVer/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -outfile Microsoft.DesktopAppInstaller.WinGet.appx
# Install WingetWith License
Add-AppxProvisionedPackage -Online -PackagePath .\Microsoft.DesktopAppInstaller.WinGet.appx -LicensePath .\license.xml
```
@lighthouseofthenight
Copy link

I usually install like this, works fine, just don't miss new dependencies introduced in recent versions. Also install for current user if app readiness services are not doing it for you:

powershell
cd ~\Downloads
Start-BitsTransfer -Source "https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -Destination "~\Downloads\WinGet.msixbundle"
Start-BitsTransfer -Source "https://github.com/microsoft/winget-cli/releases/latest/download/DesktopAppInstaller_Dependencies.zip" -Destination "~\Downloads\DesktopAppInstaller_Dependencies.zip"
Start-BitsTransfer -Source "https://github.com/microsoft/winget-cli/releases/latest/download/e53e159d00e04f729cc2180cffd1c02e_License1.xml" -Destination "~\Downloads\license.xml"
Expand-Archive -Path "~\Downloads\DesktopAppInstaller_Dependencies.zip"
Add-AppxPackage "~\Downloads\DesktopAppInstaller_Dependencies\x64\Microsoft.UI.Xaml*x64.appx"
Add-AppxPackage "~\Downloads\DesktopAppInstaller_Dependencies\x64\Microsoft.VCLibs*x64.appx"
Add-AppxPackage "~\Downloads\DesktopAppInstaller_Dependencies\x64\Microsoft.WindowsAppRuntime*x64.appx"
Add-AppxProvisionedPackage -Online -PackagePath .\WinGet.msixbundle -LicensePath .\license.xml
Get-AppPackage *Microsoft.DesktopAppInstaller*|select Name,PackageFullName
winget --info
Remove-Item -Path "~\Downloads\WinGet.msixbundle", "~\Downloads\DesktopAppInstaller_Dependencies.zip", "~\Downloads\DesktopAppInstaller_Dependencies", "~\Downloads\license.xml" -Recurse -Force

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment