fix: force MSI uninstall flag /X and pause between uninstall steps
This commit is contained in:
@@ -323,6 +323,13 @@ function Invoke-UninstallSoftware {
|
|||||||
# But if standard fails, we see it now.
|
# But if standard fails, we see it now.
|
||||||
$finalCmd = "$rawCmd"
|
$finalCmd = "$rawCmd"
|
||||||
|
|
||||||
|
# FIX: Some MSI commands use /I (Install/Configure) instead of /X (Uninstall).
|
||||||
|
# We force /X to ensure it triggers the removal process.
|
||||||
|
if ($finalCmd -match "(?i)msiexec.*\/I\s*{") {
|
||||||
|
Write-Host " [!] Detected MSI Install flag (/I). Swapping to Uninstall flag (/X)..." -ForegroundColor Magenta
|
||||||
|
$finalCmd = $finalCmd -replace "(?i)\/I", "/X"
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host " Executing: $($finalCmd)" -ForegroundColor Cyan
|
Write-Host " Executing: $($finalCmd)" -ForegroundColor Cyan
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -331,10 +338,11 @@ function Invoke-UninstallSoftware {
|
|||||||
} catch {
|
} catch {
|
||||||
Write-Host " [!] Error launching: $($_.Exception.Message)" -ForegroundColor Red
|
Write-Host " [!] Error launching: $($_.Exception.Message)" -ForegroundColor Red
|
||||||
}
|
}
|
||||||
Start-Sleep -Seconds 1
|
|
||||||
|
Write-Host " (Press ENTER to continue to next app...)" -ForegroundColor DarkGray
|
||||||
|
[void](Read-Host)
|
||||||
}
|
}
|
||||||
Write-Progress -Activity "Uninstalling Software" -Completed
|
Write-Progress -Activity "Uninstalling Software" -Completed Write-Host "`nDone processing list." -ForegroundColor Green
|
||||||
Write-Host "`nDone processing list." -ForegroundColor Green
|
|
||||||
Wait-Key
|
Wait-Key
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user