Install Winget Using Powershell Updated 〈2024〉
# 1. Set the security protocol to TLS 1.2 to ensure secure downloads [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 # 2. Define the download URLs for the dependencies and the main package $VCLibsUrl = "https://aka.ms" $UiXamlUrl = "https://github.com" $WingetUrl = "https://github.com" # 3. Download the packages to the temp directory Invoke-WebRequest -Uri $VCLibsUrl -OutFile "$env:TEMP\VCLibs.appx" Invoke-WebRequest -Uri $UiXamlUrl -OutFile "$env:TEMP\UiXaml.appx" Invoke-WebRequest -Uri $WingetUrl -OutFile "$env:TEMP\Winget.msixbundle" # 4. Install the dependencies first Add-AppxPackage -Path "$env:TEMP\VCLibs.appx" Add-AppxPackage -Path "$env:TEMP\UiXaml.appx" # 5. Install Winget (App Installer) Add-AppxPackage -Path "$env:TEMP\Winget.msixbundle" # 6. Clean up downloaded files Remove-Item "$env:TEMP\VCLibs.appx", "$env:TEMP\UiXaml.appx", "$env:TEMP\Winget.msixbundle" -ErrorAction SilentlyContinue Use code with caution. Why dependencies matter
Start-Process "ms-windows-store://downloadsandupdates"
Double-click the file or run the following in PowerShell (admin):
Open PowerShell as an administrator and run the following command to check if winget is already installed: install winget using powershell updated
module. He spoke the words to download the tools directly from the PowerShell Gallery powershell # Trust the gallery first
This article is your definitive, up-to-date guide. We will walk you through everything from verifying if Winget is already on your system to performing a fresh installation using PowerShell, updating it to the latest version, and even troubleshooting the most common errors. By the end, you will be able to manage your Windows software like a pro from the command line.
Once the module is installed, you can use the Repair-WinGetPackageManager cmdlet. This script automatically downloads the latest stable version of Winget from GitHub and installs it for you. Clean up downloaded files Remove-Item "$env:TEMP\VCLibs
WinGet has transformed how Windows users and administrators manage software. It eliminates tedious manual processes and enables batch automation that previously required complex scripting. The irony that WinGet lacks a built-in command-line installer is now a solved problem, thanks to the community-driven winget-install script.
Add-AppxPackage -RegisterByFamilyName -MainPackage "Microsoft.DesktopAppInstaller_8wekyb3d8bbwe" Use code with caution. Verifying the Installation
Verify the installation:
Install-Module Microsoft.WinGet.Client -Force
# Define the URL for the latest stable WinGet bundle $url = "https://aka.ms" $dest = "$env:TEMP\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" # Download the package Invoke-WebRequest -Uri $url -OutFile $dest # Install the package package for the current user Add-AppxPackage -Path $dest Use code with caution. Verify the Installation
# Bootstrap or repair the WinGet package manager and all dependencies Repair-WinGetPackageManager -AllUsers Use code with caution. Copied to clipboard Option 2: One-Line Installation Script Fast Install via PowerShell Script
To make changes to system packages, you need elevated privileges. Press the . Type PowerShell .
Before installing, verify if WinGet is already on your system. Open PowerShell as Administrator. Run the command: winget --version . If you see a version number, you're ready to go! 2. Fast Install via PowerShell Script