From 45ec574221d6ac33c1e5f03f5ebfbe7dbf2b1e70 Mon Sep 17 00:00:00 2001 From: Rux Date: Sun, 31 Mar 2024 10:03:48 -0700 Subject: [PATCH] Winget Sources fix (#1773) - Sometimes, if Winget is installed under user-scope, the source isn't properly installed so that the Admin user can properly use Winget. - This change installs the sources directly from the Winget CDN. - Fixes #1771 https://github.com/microsoft/winget-cli/discussions/3258#discussioncomment-5951658 --- functions/private/Install-WinUtilWinget.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/private/Install-WinUtilWinget.ps1 b/functions/private/Install-WinUtilWinget.ps1 index a0c7b7bd..2bdba08e 100644 --- a/functions/private/Install-WinUtilWinget.ps1 +++ b/functions/private/Install-WinUtilWinget.ps1 @@ -40,6 +40,8 @@ function Install-WinUtilWinget { Get-WinUtilWingetLatest Write-Host "Installing Winget w/ Prerequsites`r" Add-AppxProvisionedPackage -Online -PackagePath $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle -DependencyPackagePath $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx, $ENV:TEMP\Microsoft.UI.Xaml.x64.appx -LicensePath $ENV:TEMP\License1.xml + Write-Host "Manually adding Winget Sources, from Winget CDN." + Add-AppxPackage -Path https://cdn.winget.microsoft.com/cache/source.msix #Seems some installs of Winget don't add the repo source, this should makes sure that it's installed every time. Write-Host "Winget Installed" -ForegroundColor Green # Winget only needs a refresh of the environment variables to be used. Write-Output "Refreshing Environment Variables...`n"