Fix uninstall

This commit is contained in:
Sander Declerck 2026-01-19 16:17:34 +01:00
parent 1de6a4ac4b
commit fc43d93828
No known key found for this signature in database

View file

@ -79,14 +79,14 @@ function getWindowsArchitecture() {
}
async function uninstallIfInstalled() {
const powershellScript = `$app = Get-WmiObject -Class Win32_Product -Filter "Name='SafeChain Agent'"; if ($app) { Write-Output $app.IdentifyingNumber }`;
ui.writeVerbose(`Finding product code with PowerShell`);
let productCode;
try {
productCode = execSync(`powershell -Command "${powershellScript}"`, {
encoding: "utf8",
}).trim();
productCode = execSync(
`powershell -Command "$app = Get-WmiObject -Class Win32_Product -Filter \\"Name='SafeChain Agent'\\"; if ($app) { Write-Output $app.IdentifyingNumber }"`,
{ encoding: "utf8" },
).trim();
} catch {
ui.writeVerbose("No existing installation found (fresh install).");
return;