From 2237c805f4bff1a42424f113c592840a97a79ab4 Mon Sep 17 00:00:00 2001 From: tomamplius Date: Mon, 27 May 2024 17:00:50 +0200 Subject: [PATCH] allow update --- Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 b/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 index 73f4395..ec24e6f 100644 --- a/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 +++ b/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 @@ -13,6 +13,9 @@ Forward Winget App ID to install. For multiple apps, separate with ",". Case sen .PARAMETER Uninstall To uninstall app. Works with AppIDs +.PARAMETER AllowUpgrade +To allow upgrade app if present. Works with AppIDs + .PARAMETER LogPath Used to specify logpath. Default is same folder as Winget-Autoupdate project @@ -34,6 +37,9 @@ If '-Uninstall' is used, it removes the app from WAU White List. .EXAMPLE .\winget-install.ps1 -AppIDs "7zip.7zip -v 22.00", "Notepad++.Notepad++" + +.EXAMPLE +.\winget-install.ps1 -AppIDs "Notepad++.Notepad++" -AllowUpgrade #> [CmdletBinding()] @@ -41,7 +47,8 @@ param( [Parameter(Mandatory = $True, ParameterSetName = "AppIDs")] [String[]] $AppIDs, [Parameter(Mandatory = $False)] [Switch] $Uninstall, [Parameter(Mandatory = $False)] [String] $LogPath, - [Parameter(Mandatory = $False)] [Switch] $WAUWhiteList + [Parameter(Mandatory = $False)] [Switch] $WAUWhiteList, + [Parameter(Mandatory = $False)] [Switch] $AllowUpgrade ) @@ -136,7 +143,7 @@ function Test-ModsUninstall ($AppID) { #Install function function Install-App ($AppID, $AppArgs) { $IsInstalled = Confirm-Installation $AppID - if (!($IsInstalled)) { + if (!($IsInstalled) -or $AllowUpgrade ) { #Check if mods exist (or already exist) for preinstall/install/installedonce/installed $ModsPreInstall, $ModsInstall, $ModsInstalledOnce, $ModsInstalled = Test-ModsInstall $($AppID)