Improved exit code with errors, improved service detection logic, additional logging for Support#146
Conversation
Alan-Huntress
commented
Dec 22, 2025
- Reworked the exit logic to throw an error if the script can’t finish the action it was executed for. Partners who use RMM’s with this script (such as Ninja) were seeing exit code 0 sometimes when the script was failing to deploy/uninstall/reinstall which makes it more difficult for them to see status at a glance inside their RMM.
- Made a quick pass at standardizing script output for errors.
- Improved service detection logic during uninstall.
- Look for Visual C++ and log if it’s found or not (needed for Rio, see https://huntress.slack.com/archives/C06B99GUBC1/p1766166810829269 ).
|
Fwiw, I agree with most of the fixes, and thank you for taking the initiative. Doing it here is tricky because it creates multiple points of management, and the it needs to be conditioned on OS version. |
I rescind my comment, I though this was enforcing and I stand corrected. 🙇 |
uttie-huntress
left a comment
There was a problem hiding this comment.
The logic itself makes sense to me, though I'll defer to someone about PS review itself.
|
fwiw, I've added a script to the shortcut, it has couple other attributes we might wanna gather.
|
Using Uttie's VC++ checking script from this Shortcut https://app.shortcut.com/huntress/story/180295/investigate-windows-8-1-rio-install-failures#activity-180308
|
Hey @mguy-huntress, the script looks good, and support wants to get ahead of this problem until we can fix it in the product. |
* Changing the order of logging around for efficiency. Log as much overview info as possible first in case the script is unable to complete the overview info will at least be logged (script version, flags that were passed, and keys). * Write-InstallScriptInfo was not able to run previously as 'main' always was exiting before the function 'Write-InstallScriptInfo' could be called. Moved the exit command to later in execution.
|
I know the team's pretty busy and if this works in your testing, I'd suggest committing it. |
The URLs the agent uses have changed slightly over time.