Install winget-cli from PowerShell
- Install winget-cli straight from PowerShell
- Works on Windows 10, Windows 11, Server 2019/2022
- Always gets the latest version of winget
How to use
Method 1 - no need to download the file because it connects to PSGallery to fetch it
-
In PowerShell, type
Install-Script -Name winget-install
and answer yes to any prompts -
Then type
winget-install
Tip - how to trust PSGallery
If you want to trust PSGallery so you aren't prompted each time you run this command, you can type...
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
Method 2 - download file locally and run
-
Download
winget-install.ps1
orwinget-install-signed.zip
(and extract the inner PS1 script) -
Run the script with
.\winget-install.ps1
Available Scripts
-
winget-install.ps1
- Unsigned script
-
winget-install-signed.zip
-
Signed script
-
Compressed for transport and to retain signature
-
Uncompress to use
-
For use if you do not want to enable unsigned script execution in PowerShell
-
Script Functionality
-
Processor architecture is determined for prerequisites
-
VCLibs is installed straight from the appx package
-
Xaml is installed by downloading the nupkg, extracting it, and installing the appx package
-
winget-cli is then installed
-
User PATH variable is adjusted to include WindowsApps folder
-
Grabs the latest version of winget on each run
Note
- If you receive an error message about the Appx module not being loaded, try using a different version of PowerShell (version 6 and 7 seem to be buggy still, but the native PowerShell version in Windows works)