Files
fleet/pkg/file/scripts
Allen Houchins 7cb898d20f Treat MSI reboot exit codes as success (#47023)
This pull request updates the uninstall scripts to treat additional MSI
exit codes that indicate a successful uninstall (but may require a
reboot) as success, rather than failure. This improves the robustness of
the uninstall process by not incorrectly flagging these scenarios as
errors.

**Improvements to exit code handling in uninstall scripts:**

* Added support for treating MSI exit codes `3010`
(ERROR_SUCCESS_REBOOT_REQUIRED) and `1641`
(ERROR_SUCCESS_REBOOT_INITIATED) as success, in addition to `0`, in both
`uninstall_msi.ps1` and `uninstall_msi_with_upgrade_code.ps1`. This is
achieved by introducing a `$successCodes` array and updating the exit
code checks to use it.
[[1]](diffhunk://#diff-09e225a2a28fbf997ddf571274119a20d9210539e5bdd49749beb2226e6de5aaR15-R20)
[[2]](diffhunk://#diff-c24faec992d742fed7d16c8621f140f7048ecb2cc88bd135fcf02cbd8653f77bR5-R8)
[[3]](diffhunk://#diff-c24faec992d742fed7d16c8621f140f7048ecb2cc88bd135fcf02cbd8653f77bL17-R21)

**Test updates:**

* Updated the golden test data for `uninstall_msi.ps1` to reflect the
new logic for handling successful exit codes.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved MSI uninstall handling to recognize additional success
conditions, including scenarios requiring system restart, enhancing the
reliability of software removal operations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-06-07 21:38:18 -05:00
..

File scripts

This folder contains scripts to install/remove software for different types of installers.

Scripts are stored on their own files for two reasons:

  1. Some of them are read and displayed in the UI.
  2. It's helpful to have good syntax highlighting and easy ways to run them.

Scripts

  • install_*.*: Default installer scripts for each platform.
  • uninstall_*.*: Default uinstaller scripts for each platform.
  • remove_*.*: Uninstaller scripts used when the uninstall script is not set (for packages added before the uninstall feature was released) or empty uninstaller scripts.

Variables

The scripts in this folder accept variables like $VAR_NAME that will be replaced/populated by fleetd when they run.

Supported variables are:

  • $INSTALLER_PATH path to the installer file.