Skip to content

Instantly share code, notes, and snippets.

@nick123pig
Created December 19, 2023 22:14
Show Gist options
  • Save nick123pig/cbefa195ec61e94d5c840d9e55402a39 to your computer and use it in GitHub Desktop.
Save nick123pig/cbefa195ec61e94d5c840d9e55402a39 to your computer and use it in GitHub Desktop.
if (!(Get-Command winget -errorAction SilentlyContinue))
{
# get latest download url
$URL = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"
$URL = (Invoke-WebRequest -Uri $URL).Content | ConvertFrom-Json |
Select-Object -ExpandProperty "assets" |
Where-Object "browser_download_url" -Match '.msixbundle' |
Select-Object -ExpandProperty "browser_download_url"
# download
Invoke-WebRequest -Uri $URL -OutFile "Setup.msix" -UseBasicParsing
# install
Add-AppxPackage -Path "Setup.msix"
# delete file
Remove-Item "Setup.msix"
}
winget install "openssh beta" --accept-package-agreements --accept-source-agreements --disable-interactivity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment