diff --git a/README.md b/README.md index 573eb1b..c583fb1 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Add (or remove) the apps' ID you want to disable autoupdate to 'excluded_apps.tx - #### Or AllowList You can update only pre-selected apps. To do so, create an "included_apps.txt" with the apps' ID of the apps you want to auto-update and run the `Winget-AutoUpdate-Install.ps1` with `-UseWhiteList` parameter. Related post: https://github.com/Romanitho/Winget-AutoUpdate/issues/36 -> You can use WiGui to create these lists: https://github.com/Romanitho/Winget-Install-GUI +> The lists can contain Wildcard (*). For instance ```Mozilla.Firefox*``` will take care of all Firefox channels. (From v1.19.2-7) ### Notification Level You can choose which notification will be displayed: Full, Success only or none. Use `-NotificationLevel` parameter when you run `Winget-AutoUpdate-Install.ps1`. diff --git a/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 b/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 index 00e1803..6511b42 100644 --- a/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 +++ b/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 @@ -292,14 +292,20 @@ if (Test-Network) { if ($UseWhiteList) { #For each app, notify and update foreach ($app in $outdated) { - if (($toUpdate -contains $app.Id) -and $($app.Version) -ne "Unknown") { - Update-App $app - } - #if current app version is unknown - elseif ($($app.Version) -eq "Unknown") { + #if current app version is unknown, skip it + if ($($app.Version) -eq "Unknown") { Write-ToLog "$($app.Name) : Skipped upgrade because current version is 'Unknown'" "Gray" } - #if app is in "excluded list" + #if app is in "include list", update it + elseif ($toUpdate -contains $app.Id) { + Update-App $app + } + #if app with wildcard is in "include list", update it + elseif ($toUpdate | Where-Object { $app.Id -like $_ }) { + Write-ToLog "$($app.Name) is wildcard in the include list." + Update-App $app + } + #else, skip it else { Write-ToLog "$($app.Name) : Skipped upgrade because it is not in the included app list" "Gray" } @@ -309,17 +315,22 @@ if (Test-Network) { else { #For each app, notify and update foreach ($app in $outdated) { - if (-not ($toSkip -contains $app.Id) -and $($app.Version) -ne "Unknown") { - Update-App $app - } - #if current app version is unknown - elseif ($($app.Version) -eq "Unknown") { + #if current app version is unknown, skip it + if ($($app.Version) -eq "Unknown") { Write-ToLog "$($app.Name) : Skipped upgrade because current version is 'Unknown'" "Gray" } - #if app is in "excluded list" - else { + #if app is in "excluded list", skip it + elseif ($toSkip -contains $app.Id) { Write-ToLog "$($app.Name) : Skipped upgrade because it is in the excluded app list" "Gray" } + #if app with wildcard is in "excluded list", skip it + elseif ($toSkip | Where-Object { $app.Id -like $_ }) { + Write-ToLog "$($app.Name) : Skipped upgrade because it is *wildcard* in the excluded app list" "Gray" + } + # else, update it + else { + Update-App $app + } } } diff --git a/Sources/WAU/excluded_apps.txt b/Sources/WAU/excluded_apps.txt index f40e6eb..32e98fb 100644 --- a/Sources/WAU/excluded_apps.txt +++ b/Sources/WAU/excluded_apps.txt @@ -5,8 +5,5 @@ Microsoft.Office Microsoft.OneDrive Microsoft.Teams Microsoft.Teams.Classic -Mozilla.Firefox -Mozilla.Firefox.DeveloperEdition -Mozilla.Firefox.ESR -TeamViewer.TeamViewer -TeamViewer.TeamViewer.Host +Mozilla.Firefox* +TeamViewer.TeamViewer*