From fa376f052d704e69e7e5d630546db5967401eedc Mon Sep 17 00:00:00 2001 From: tomamplius Date: Thu, 16 May 2024 10:35:26 +0200 Subject: [PATCH 1/2] Update winget-install.ps1 Allow Upgrade --- winget-install.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/winget-install.ps1 b/winget-install.ps1 index 43ca316..acb4327 100644 --- a/winget-install.ps1 +++ b/winget-install.ps1 @@ -41,7 +41,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, ) @@ -302,7 +303,7 @@ function Test-ModsUninstall ($AppID) { #Install function function Install-App ($AppID, $AppArgs) { $IsInstalled = Confirm-Install $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) From a0d7ef6684ce2571f4cbd07870a55ae1bafbda16 Mon Sep 17 00:00:00 2001 From: tomamplius Date: Thu, 16 May 2024 10:45:23 +0200 Subject: [PATCH 2/2] Update winget-install.ps1 add comment and remove comma --- winget-install.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/winget-install.ps1 b/winget-install.ps1 index acb4327..8bc6119 100644 --- a/winget-install.ps1 +++ b/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()] @@ -42,7 +48,7 @@ param( [Parameter(Mandatory = $False)] [Switch] $Uninstall, [Parameter(Mandatory = $False)] [String] $LogPath, [Parameter(Mandatory = $False)] [Switch] $WAUWhiteList, - [Parameter(Mandatory = $False)] [Switch] $AllowUpgrade, + [Parameter(Mandatory = $False)] [Switch] $AllowUpgrade )