Skip to content

Instantly share code, notes, and snippets.

@maxichrome
Last active November 25, 2022 05:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxichrome/a91063dcd0fbd05e69e1691ffa20da6d to your computer and use it in GitHub Desktop.
Save maxichrome/a91063dcd0fbd05e69e1691ffa20da6d to your computer and use it in GitHub Desktop.
# installs winget on Windows Server
# stolen from https://github.com/actions/runner-images/issues/910#issuecomment-1291001212
Invoke-WebRequest -Uri 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx' -OutFile 'VCLibs.appx' # automatically downloads latest version
Invoke-WebRequest -Uri 'https://github.com/microsoft/winget-cli/releases/download/latest/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle' -OutFile 'winget.msixbundle'
$ReleaseInfo = Invoke-RestMethod 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
Invoke-WebRequest -Uri $ReleaseInfo.assets.Where({ $_.name.EndsWith('License1.xml') }).browser_download_url -OutFile 'license.xml' # because the prefix of the file changes with every release
Add-AppxProvisionedPackage -Online -PackagePath winget.msixbundle -LicensePath license.xml -DependencyPackagePath VCLibs.appx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment