From e63ff4ef0a53a7e033d3b92b2b8a9c8d3feb52cd Mon Sep 17 00:00:00 2001 From: romanitho <96626929+Romanitho@users.noreply.github.com> Date: Fri, 3 Jun 2022 21:54:09 +0200 Subject: [PATCH] Added Winget source reset Due to error on my machine, I needed to reset Wignet sources. It might happen to others so reset is run on WAU update from now. --- Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 b/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 index ffdf285..4a9c6b2 100644 --- a/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 +++ b/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 @@ -4,6 +4,15 @@ function Invoke-PostUpdateActions { #log Write-Log "Running Post Update actions..." "yellow" + + #Reset Winget Sources + $ResolveWingetPath = Resolve-Path "$env:programfiles\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe\winget.exe" + if ($ResolveWingetPath){ + #If multiple version, pick last one + $WingetPath = $ResolveWingetPath[-1].Path + & $WingetPath source reset --force + Write-Log "-> Winget sources reseted." "green" + } #Create WAU Regkey if not present $regPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"