Skip to content

Instantly share code, notes, and snippets.

@myty
Forked from crutkas/InstallWinGet.ps1
Last active December 9, 2022 13:37
Show Gist options
  • Save myty/4e7c3b40e6b3699767030c1d3b1925cc to your computer and use it in GitHub Desktop.
Save myty/4e7c3b40e6b3699767030c1d3b1925cc to your computer and use it in GitHub Desktop.
InstallWinGet PowerShell
function InstallWinGet()
{
$hasPackageManager = Get-AppPackage -name "Microsoft.DesktopAppInstaller"
if(!$hasPackageManager)
{
$releases_url = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$releases = Invoke-RestMethod -uri "$($releases_url)"
$latestRelease = $releases.assets | Where { $_.browser_download_url.EndsWith("msixbundle") } | Select -First 1
Add-AppxPackage -Path $latestRelease.browser_download_url
Write-Host "Winget Installed Successfully!" -foreground Green
return
}
Write-Host "Winget is already installed" -foreground Yellow
}
InstallWinget
<#
Add-AppxPackage -Path "https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx"
$releases_url = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$releases = Invoke-RestMethod -uri "$($releases_url)"
$latestRelease = $releases.assets | Where { $_.browser_download_url.EndsWith("appxbundle") } | Select -First 1
Add-AppxPackage -Path $latestRelease.browser_download_url
#>
@kiquenet
Copy link

kiquenet commented Dec 9, 2022

choco vs winget vs scoop ?

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