From 6659404bd77e7c60b909d04324c664c8aa02843d Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Sun, 1 Jan 2023 01:58:43 +0100 Subject: [PATCH] Corrected --- Winget-AutoUpdate/mods/_Mods-Functions.ps1 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Winget-AutoUpdate/mods/_Mods-Functions.ps1 b/Winget-AutoUpdate/mods/_Mods-Functions.ps1 index 88a6b4d..9bd8bc4 100644 --- a/Winget-AutoUpdate/mods/_Mods-Functions.ps1 +++ b/Winget-AutoUpdate/mods/_Mods-Functions.ps1 @@ -19,6 +19,7 @@ function Uninstall-ModsApp ($App) { foreach ($obj in $InstalledSoftware){ if ($obj.GetValue('DisplayName') -like $App) { $UninstallString = $obj.GetValue('UninstallString') + $CleanedUninstallString = $UninstallString.Trim([char]0x0022) if ($UninstallString -like "MsiExec.exe*") { $ProductCode = Select-String "{.*}" -inputobject $UninstallString $ProductCode = $ProductCode.matches.groups[0].value @@ -39,16 +40,16 @@ function Uninstall-ModsApp ($App) { Start-Process $Command -ArgumentList $Parameter -Wait } else { - if ((Test-Path "$UninstallString")) { - $NullSoft = Select-String -Path $UninstallString.Trim([char]0x0022) -Pattern "Nullsoft" + if ((Test-Path $CleanedUninstallString)) { + $NullSoft = Select-String -Path $CleanedUninstallString -Pattern "Nullsoft" } if ($NullSoft) { #NSIS x64 Installer Start-Process $UninstallString -ArgumentList "/S" -Wait } else { - if ((Test-Path "$UninstallString")) { - $Inno = Select-String -Path $UninstallString.Trim([char]0x0022) -Pattern "Inno Setup" + if ((Test-Path $CleanedUninstallString)) { + $Inno = Select-String -Path $CleanedUninstallString -Pattern "Inno Setup" } if ($Inno) { #Inno x64 Installer @@ -74,6 +75,7 @@ function Uninstall-ModsApp ($App) { foreach ($obj in $InstalledSoftware){ if ($obj.GetValue('DisplayName') -like $App) { $UninstallString = $obj.GetValue('UninstallString') + $CleanedUninstallString = $UninstallString.Trim([char]0x0022) if ($UninstallString -like "MsiExec.exe*") { $ProductCode = Select-String "{.*}" -inputobject $UninstallString $ProductCode = $ProductCode.matches.groups[0].value @@ -94,16 +96,16 @@ function Uninstall-ModsApp ($App) { Start-Process $Command -ArgumentList $Parameter -Wait } else { - if ((Test-Path "$UninstallString")) { - $NullSoft = Select-String -Path $UninstallString.Trim([char]0x0022) -Pattern "Nullsoft" + if ((Test-Path $CleanedUninstallString)) { + $NullSoft = Select-String -Path $CleanedUninstallString -Pattern "Nullsoft" } if ($NullSoft) { #NSIS x86 Installer Start-Process $UninstallString -ArgumentList "/S" -Wait } else { - if ((Test-Path "$UninstallString")) { - $Inno = Select-String -Path $UninstallString.Trim([char]0x0022) -Pattern "Inno Setup" + if ((Test-Path $CleanedUninstallString)) { + $Inno = Select-String -Path $CleanedUninstallString -Pattern "Inno Setup" } if ($Inno) { #Inno x86 Installer