Skip to content

Instantly share code, notes, and snippets.

@Jawabiscuit
Last active March 21, 2022 01:40
Show Gist options
  • Save Jawabiscuit/57d7b5506c54c019c9c6e40fee485fa6 to your computer and use it in GitHub Desktop.
Save Jawabiscuit/57d7b5506c54c019c9c6e40fee485fa6 to your computer and use it in GitHub Desktop.
Install winget package manager and dependencies
# Install Winget package manager
# Dependencies
# https://docs.microsoft.com/en-us/troubleshoot/developer/visualstudio/cpp/libraries/c-runtime-packages-desktop-bridge#how-to-install-and-update-desktop-framework-packages
$PackageName = "Microsoft.VCLibs.x64.14.00.Desktop.appx"
$DependencyUrl = "https://aka.ms/${PackageName}"
Invoke-WebRequest -Uri $DependencyUrl -OutFile (Join-Path $env:TEMP $PackageName)
Add-AppxPackage -Path (Join-Path $env:TEMP $PackageName)
# Download/Install winget
$PackageName = "Microsoft.DesktopAppInstaller"
$GithubUrl = "https://github.com/microsoft/winget-cli/releases/latest"
$HttpContent = Invoke-WebRequest -URI $GithubUrl -UseBasicParsing
$HttpContent.Links | Where-Object {$_.href -like "${PackageName}*.msixbundle"} | ForEach-Object {Invoke-WebRequest -Uri ("https://github.com" + $_.href) -OutFile (Join-Path $env:TEMP "${PackageName}.msixbundle")}
Add-AppxPackage -Path (Join-Path $env:TEMP "${PackageName}.msixbundle")
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:TEMP\*.appx"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:TEMP\*.msixbundle"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment