fleet/pkg/file/testdata/scripts/uninstall_msi.ps1.golden
Scott Gress 176f39c247
Update script test "golden" files (#36129)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** For #36111

The updates in https://github.com/fleetdm/fleet/pull/36111 caused some
tests to start failing. I ran the suggested script:

```
go test ./pkg/file/... -update
```

and verified that the changes match the changes in the above PR
[here](https://github.com/fleetdm/fleet/pull/36111/files#diff-09e225a2a28fbf997ddf571274119a20d9210539e5bdd49749beb2226e6de5aa).
2025-11-21 11:37:36 -06:00

22 lines
660 B
Text

$product_code = $PACKAGE_ID
$timeoutSeconds = 300 # 5 minute timeout
# Fleet uninstalls app using product code that's extracted on upload
$process = Start-Process msiexec -ArgumentList @("/quiet", "/x", $product_code, "/norestart") -PassThru
# Wait for process with timeout
$completed = $process.WaitForExit($timeoutSeconds * 1000)
if (-not $completed) {
Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
Exit 1603 # ERROR_UNINSTALL_FAILURE
}
# Check exit code and output result
if ($process.ExitCode -eq 0) {
Write-Output "Exit 0"
Exit 0
} else {
Write-Output "Exit $($process.ExitCode)"
Exit $process.ExitCode
}