From 3e04b1d544cf447f145918952a8830786de93dc5 Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Sun, 25 Sep 2022 16:54:58 +0200 Subject: [PATCH] A few small fixes --- Winget-AutoUpdate-Install.ps1 | 6 +++--- Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 | 4 ++-- Winget-AutoUpdate/functions/Get-IncludedApps.ps1 | 4 ++-- Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 | 2 +- Winget-AutoUpdate/winget-upgrade.ps1 | 5 ++++- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Winget-AutoUpdate-Install.ps1 b/Winget-AutoUpdate-Install.ps1 index 9585956..e085ae2 100644 --- a/Winget-AutoUpdate-Install.ps1 +++ b/Winget-AutoUpdate-Install.ps1 @@ -277,9 +277,6 @@ function Install-WingetAutoUpdate { New-ItemProperty $regPath -Name DisplayIcon -Value "C:\Windows\System32\shell32.dll,-16739" -Force | Out-Null New-ItemProperty $regPath -Name DisplayVersion -Value $WAUVersion -Force | Out-Null New-ItemProperty $regPath -Name InstallLocation -Value $WingetUpdatePath -Force | Out-Null - if ($ListPath){ - New-ItemProperty $regPath -Name ListPath -Value $ListPath -Force | Out-Null - } New-ItemProperty $regPath -Name UninstallString -Value "powershell.exe -noprofile -executionpolicy bypass -file `"$WingetUpdatePath\WAU-Uninstall.ps1`"" -Force | Out-Null New-ItemProperty $regPath -Name QuietUninstallString -Value "powershell.exe -noprofile -executionpolicy bypass -file `"$WingetUpdatePath\WAU-Uninstall.ps1`"" -Force | Out-Null New-ItemProperty $regPath -Name NoModify -Value 1 -Force | Out-Null @@ -300,6 +297,9 @@ function Install-WingetAutoUpdate { if (!$RunOnMetered) { New-ItemProperty $regPath -Name WAU_DoNotRunOnMetered -Value 1 -PropertyType DWord -Force | Out-Null } + if ($ListPath){ + New-ItemProperty $regPath -Name ListPath -Value $ListPath -Force | Out-Null + } Write-host "WAU Installation succeeded!" -ForegroundColor Green Start-sleep 1 diff --git a/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 b/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 index 79e5ca4..bcd26ca 100644 --- a/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 +++ b/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 @@ -4,8 +4,8 @@ function Get-ExcludedApps { if (Test-Path "$WorkingDir\excluded_apps.txt") { - return Get-Content -Path "$WorkingDir\excluded_apps.txt" + return (Get-Content -Path "$WorkingDir\excluded_apps.txt").Trim() | Where-Object{$_.length -gt 0} } -} \ No newline at end of file +} diff --git a/Winget-AutoUpdate/functions/Get-IncludedApps.ps1 b/Winget-AutoUpdate/functions/Get-IncludedApps.ps1 index 199773b..e9a31a5 100644 --- a/Winget-AutoUpdate/functions/Get-IncludedApps.ps1 +++ b/Winget-AutoUpdate/functions/Get-IncludedApps.ps1 @@ -4,8 +4,8 @@ function Get-IncludedApps { if (Test-Path "$WorkingDir\included_apps.txt") { - return Get-Content -Path "$WorkingDir\included_apps.txt" + return (Get-Content -Path "$WorkingDir\included_apps.txt").Trim() | Where-Object{$_.length -gt 0} } -} \ No newline at end of file +} diff --git a/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 b/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 index 23f86a1..f03fae8 100644 --- a/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 +++ b/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 @@ -6,7 +6,7 @@ function Invoke-PostUpdateActions { Write-Log "Running Post Update actions..." "yellow" #Reset Winget Sources - $ResolveWingetPath = Resolve-Path "$env:programfiles\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe\winget.exe" + $ResolveWingetPath = Resolve-Path "$env:programfiles\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe\winget.exe" | Sort-Object { [version]($_.Path -replace '^[^\d]+_((\d+\.)*\d+)_.*', '$1') } if ($ResolveWingetPath) { #If multiple version, pick last one $WingetPath = $ResolveWingetPath[-1].Path diff --git a/Winget-AutoUpdate/winget-upgrade.ps1 b/Winget-AutoUpdate/winget-upgrade.ps1 index 9f00f44..2732fb0 100644 --- a/Winget-AutoUpdate/winget-upgrade.ps1 +++ b/Winget-AutoUpdate/winget-upgrade.ps1 @@ -60,11 +60,14 @@ if (Test-Network) { #Get External ListPath if ($WAUConfig.ListPath) { - Write-Log "WAU uses External Lists" + Write-Log "WAU uses External Lists from $WAUConfig.ListPath" $NewList = Test-ListPath $WAUConfig.ListPath $WAUConfig.WAU_UseWhiteList $WAUConfig.InstallLocation if ($NewList) { Write-Log "Newer List downloaded to local path" } + else { + Write-Log "No newer List detected" + } } #Get White or Black list