Skip to content

Instantly share code, notes, and snippets.

@gaoyifan
gaoyifan / gist:7c4d4bac07172141157472d0c2da6525
Last active January 24, 2024 13:30
Install winget on Windows Server 2022
# from https://gist.github.com/likamrat/cae833a6e5b3461709f14c093c21c293?permalink_comment_id=4634351#gistcomment-4634351
# Install Chocolately Package Manager
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
$env:Path = [System.Environment]::ExpandEnvironmentVariables([System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User"))
# Install WinGet from Chocolatey
choco install winget
choco install winget.powershell