mirror of
https://github.com/fleetdm/fleet
synced 2026-05-14 12:38:41 +00:00
Closes #31077. - Added logic to wait for the uninstall command to finish running before exiting the script. - Also added the `/norestart` flag so users who click uninstall in self-service aren't at risk of a sudden and unintentional reboot as the result of software uninstalling. # Checklist for submitter If some of the following don't apply, delete the relevant line. <!-- Note that API documentation changes are now addressed by the product design team. --> - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. --------- Co-authored-by: Ian Littman <iansltx@gmail.com>
14 lines
No EOL
573 B
PowerShell
14 lines
No EOL
573 B
PowerShell
# Fleet uninstalls app by finding all related product codes for the specified upgrade code
|
|
$inst = New-Object -ComObject "WindowsInstaller.Installer"
|
|
foreach ($product_code in $inst.RelatedProducts("$UPGRADE_CODE")) {
|
|
$process = Start-Process msiexec -ArgumentList @("/quiet", "/x", $product_code, "/norestart") -Wait -PassThru
|
|
|
|
# If the uninstall failed, bail
|
|
if ($process.ExitCode -ne 0) {
|
|
Write-Output "Uninstall for $($product_code) exited $($process.ExitCode)"
|
|
Exit $process.ExitCode
|
|
}
|
|
}
|
|
|
|
# All uninstalls succeeded; exit success
|
|
Exit 0 |