From 45202133635cbacfd19057b137bddd82b9c3b22b Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Mon, 9 Oct 2023 04:58:53 +0200 Subject: [PATCH] Less log entries --- .../functions/Invoke-PostUpdateActions.ps1 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 b/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 index f441316..9ced4a7 100644 --- a/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 +++ b/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 @@ -26,9 +26,13 @@ function Invoke-PostUpdateActions { } #Check installed WinGet version - Get-WingetCmd - $InstalledWinGetVersion = & $Winget --version - $InstalledWinGetVersion = $InstalledWinGetVersion.Replace("v", "") + $ResolveWingetPath = Resolve-Path "$env:programfiles\WindowsApps\Microsoft.DesktopAppInstaller_*_*__8wekyb3d8bbwe\winget.exe" | Sort-Object { [version]($_.Path -replace '^[^\d]+_((\d+\.)*\d+)_.*', '$1') } + if ($ResolveWingetPath) { + #If multiple version, pick last one + $WingetPath = $ResolveWingetPath[-1].Path + $InstalledWinGetVersion = & $WingetPath --version + $InstalledWinGetVersion = $InstalledWinGetVersion.Replace("v", "") + } #Check if the current available WinGet isn't a Pre-release and if it's newer than the installed if (!($AvailableWinGetVersion -match "-pre") -and ($AvailableWinGetVersion -gt $InstalledWinGetVersion)) {