Files
simplex-chat/scripts/desktop/disable-msi-install-dir-wipe-windows.ps1
T
Narasimha-sc 79d91e716d desktop: do not delete the whole install folder when uninstalling on Windows (#7789)
* desktop: do not delete the whole install folder when uninstalling on Windows

* plans: Windows uninstall deleting the chosen install folder
2026-10-21 21:31:32 +01:00

16 lines
627 B
PowerShell

param([string]$Msi)
$ErrorActionPreference = 'Stop'
$msiOpenDatabaseModeTransact = 1
function Invoke-ComMethod($Object, [string]$Method, [object[]]$Arguments) {
$Object.GetType().InvokeMember($Method, [Reflection.BindingFlags]::InvokeMethod, $null, $Object, $Arguments)
}
$installer = New-Object -ComObject WindowsInstaller.Installer
$database = Invoke-ComMethod $installer 'OpenDatabase' @($Msi, $msiOpenDatabaseModeTransact)
$view = Invoke-ComMethod $database 'OpenView' @('DELETE FROM `WixRemoveFolderEx`')
Invoke-ComMethod $view 'Execute' @()
Invoke-ComMethod $view 'Close' @()
Invoke-ComMethod $database 'Commit' @()