How to install winget automatically with PowerShell

This page summarizes the projects mentioned and recommended in the original post on /r/msp

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • winget-cli

    WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).

  • if (!(Test-Path "$env:LOCALAPPDATA\Microsoft\WindowsApps\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\winget.exe")){ Write-Host "Winget not found." Write-Host "Creating Directories..." New-Item -path "C:\Provisioning" -ItemType Directory -Force | Out-Null New-Item -path "C:\Provisioning\Winget" -ItemType Directory -Force | Out-Null Write-Host "Downloading Winget and dependencies..." Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile C:\Provisioning\Winget\Microsoft.VCLibs.x64.14.00.Desktop.appx Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/download/v1.3.2691/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -OutFile C:\Provisioning\Winget\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/2.7.0 -OutFile C:\Provisioning\Winget\Microsoft.Ui.Xaml.2.7.0.zip Expand-Archive -path C:\Provisioning\Winget\Microsoft.Ui.Xaml.2.7.0.zip -DestinationPath C:\Provisioning\Winget\ -Force Try{ Add-AppxPackage C:\Provisioning\Winget\Microsoft.VCLibs.x64.14.00.Desktop.appx Add-AppxPackage C:\Provisioning\Winget\tools\AppX\x64\Release\Microsoft.UI.Xaml.2.7.appx Add-AppxPackage C:\Provisioning\Winget\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle Write-Host "Winget Installed!" Start-Sleep -Seconds 5 } Catch{ Write-Host "An error occurred while installing Winget. Exiting Script..." exit } } else{ Write-host "Winget found!" }

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts