How to Install Winget via PowerShell Command Line Without Manual Interaction
Windows Package Manager (Winget) is a powerful command-line tool developed by Microsoft to simplify software installation, upgrade, and management on Windows 10 and 11. It eliminates the need to manually download installers from websites or navigate the Microsoft Store, making it a favorite among developers, IT admins, and power users.
While Winget is pre-installed on newer Windows versions (Windows 11 22H2+ and Windows 10 21H1+), many users still need to install it manually—especially on older systems or fresh Windows installations. The traditional method involves visiting the Microsoft Store or downloading the installer via a browser, but this requires manual clicks.
In this blog, we’ll walk through how to install Winget entirely via PowerShell with zero manual interaction. This method is ideal for automation, scripting, or deploying Winget across multiple machines efficiently.
Table of Contents#
- Prerequisites
- Check if Winget is Already Installed
- Install Winget via PowerShell (No Manual Steps)
- Step 1: Download the App Installer Package
- Step 2: Install the Package via PowerShell
- Verify Winget Installation
- Troubleshooting Common Issues
- Conclusion
- References
Prerequisites#
Before starting, ensure your system meets these requirements:
- Windows Version: Windows 10 (build 1809 or later) or Windows 11.
- PowerShell Version: PowerShell 5.1 or newer (pre-installed on Windows 10/11). PowerShell 7+ is recommended for better compatibility.
- Internet Connection: Required to download the Winget installer.
- Administrator Privileges: Some steps (e.g., installing packages) may require admin rights.
Check if Winget is Already Installed#
First, confirm whether Winget is already on your system to avoid redundant installation.
-
Open PowerShell (search for "PowerShell" in the Start Menu, right-click, and select "Run as administrator" for full access).
-
Run the following command to check the Winget version:
winget --version- If Winget is installed: You’ll see output like
v1.6.3482(version numbers vary). Skip to Verify Installation to confirm functionality. - If Winget is not installed: You’ll get an error like
winget : The term 'winget' is not recognized.... Proceed to the next section.
- If Winget is installed: You’ll see output like
Install Winget via PowerShell (No Manual Steps)#
Winget is bundled with the "App Installer" package, which Microsoft distributes as an .msixbundle (a modern Windows app package). We’ll use PowerShell to download and install this package automatically.
Step 1: Download the App Installer Package#
The App Installer package includes Winget. We’ll download the latest version directly from Microsoft’s official CDN using PowerShell’s Invoke-WebRequest cmdlet.
-
In PowerShell (run as admin), define the URL for the latest App Installer
.msixbundle. As of 2024, the latest stable version is hosted at:$appInstallerUrl = "https://aka.ms/getwinget"Note: Microsoft updates this URL to point to the latest version, so it will always fetch the most recent installer.
-
Define a path to save the downloaded file (e.g.,
C:\Temp\AppInstaller.msixbundle). If theTempfolder doesn’t exist, create it first:$downloadPath = "$env:TEMP\AppInstaller.msixbundle" New-Item -ItemType Directory -Path "$env:TEMP" -Force | Out-Null # Ensure Temp exists -
Download the package using
Invoke-WebRequest. Add-UseBasicParsingto avoid issues with older PowerShell versions:Invoke-WebRequest -Uri $appInstallerUrl -OutFile $downloadPath -UseBasicParsing- Success: The file will download silently to
$downloadPath. - Failure: If you see errors (e.g., network issues), check your internet connection or run PowerShell with proxy settings if needed:
# Example: Use a proxy (replace with your proxy URL) Invoke-WebRequest -Uri $appInstallerUrl -OutFile $downloadPath -Proxy "http://proxy.example.com:8080" -UseBasicParsing
- Success: The file will download silently to
Step 2: Install the Package via PowerShell#
Now, install the downloaded .msixbundle using the Add-AppxPackage cmdlet, which is built into Windows for installing app packages.
-
Run the following command to install the App Installer (and Winget):
Add-AppxPackage -Path $downloadPath- What this does:
Add-AppxPackageregisters the package with Windows, installing Winget and dependencies (like the App Installer UI). - Expected Output: No errors = success. You may see warnings about dependencies, but these are usually handled automatically.
- What this does:
-
(Optional) Clean up the downloaded file to save space:
Remove-Item -Path $downloadPath -Force
Verify Winget Installation#
To confirm Winget is installed and working:
-
Close and reopen PowerShell (to refresh the PATH variable).
-
Run:
winget --versionYou should see output like:
v1.6.3482 -
Test basic functionality by listing installed packages:
winget listThis will display a list of installed apps (may take a few seconds to load).
Troubleshooting Common Issues#
1. "Add-AppxPackage: Deployment failed with HRESULT: 0x80073CF9"#
Cause: Missing dependencies (e.g., Visual C++ Runtime).
Fix: Install the Microsoft Visual C++ Redistributable for your system (x64/x86), then retry the installation.
2. "PowerShell Execution Policy Blocks Scripts"#
Cause: PowerShell’s execution policy may block Invoke-WebRequest or script execution.
Fix: Temporarily set the execution policy to RemoteSigned (run as admin):
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force Note: Reset it afterward with Set-ExecutionPolicy Restricted -Scope CurrentUser -Force if needed.
3. "Winget Still Not Recognized After Installation"#
Cause: The Winget executable path (%USERPROFILE%\AppData\Local\Microsoft\WindowsApps) may not be in your system’s PATH.
Fix: Add the path manually:
# Add WindowsApps to PATH (run as admin)
$env:PATH += ";$env:LOCALAPPDATA\Microsoft\WindowsApps"
# Refresh the PATH in the current session
refreshenv # Requires Chocolatey or manually restart PowerShell 4. "Insufficient Permissions"#
Cause: Installing system-wide packages requires admin rights.
Fix: Ensure you’re running PowerShell as an administrator (right-click > "Run as administrator").
Conclusion#
You’ve successfully installed Winget via PowerShell with zero manual interaction! This method is perfect for scripting, automation, or deploying Winget across fleets of machines. With Winget, you can now install apps like winget install Google.Chrome or winget upgrade --all in seconds.
If you encountered issues, check the Troubleshooting section or leave a comment below. Happy packaging!