From fb9117b77a48245368c03fe7e4e7536245044054 Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Sun, 1 Jan 2023 00:45:02 +0100 Subject: [PATCH] $NativeUninstallString in Mods-Functions too --- Winget-AutoUpdate/mods/_Mods-Functions.ps1 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Winget-AutoUpdate/mods/_Mods-Functions.ps1 b/Winget-AutoUpdate/mods/_Mods-Functions.ps1 index 4c97cf7..d9d9d5d 100644 --- a/Winget-AutoUpdate/mods/_Mods-Functions.ps1 +++ b/Winget-AutoUpdate/mods/_Mods-Functions.ps1 @@ -51,7 +51,12 @@ function Uninstall-ModsApp ($App) { Start-Process $UninstallString -ArgumentList "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-" -Wait } else { - Write-Host "x64 Uninstaller unknown..." + Write-Host "x64 Uninstaller unknown, trying the UninstallString from registry..." + $NativeUninstallString = Select-String "(\x22.*\x22) +(.*)" -inputobject $UninstallString + $Command = $NativeUninstallString.matches.groups[1].value + $Parameter = $NativeUninstallString.matches.groups[2].value + #All EXE x64 Installers (native defined uninstall) + Start-Process $Command -ArgumentList $Parameter -Wait } } } @@ -97,7 +102,12 @@ function Uninstall-ModsApp ($App) { Start-Process $UninstallString -ArgumentList "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-" -Wait } else { - Write-Host "x86 Uninstaller unknown..." + Write-Host "x86 Uninstaller unknown, trying the UninstallString from registry..." + $NativeUninstallString = Select-String "(\x22.*\x22) +(.*)" -inputobject $UninstallString + $Command = $NativeUninstallString.matches.groups[1].value + $Parameter = $NativeUninstallString.matches.groups[2].value + #All EXE x86 Installers (native defined uninstall) + Start-Process $Command -ArgumentList $Parameter -Wait } } }