huntresslabs / deployment-scripts

RMM deployment scripts for Huntress
37 stars 33 forks source link

Made runProcess errors more descriptive #51

Closed s-m-martin closed 1 year ago

s-m-martin commented 1 year ago

Fixes made

Run process was always printing a timeout error, even if the cause wasn't a timeout. That's been fixed so that more detailed errors are returned.

We're also separately grabbing the process object now in order to be able to properly kill it - this ensures we always kill the right process, not a process that just luckily has the same name. This removes the edge case that multiple instances of the install huntress script are running on the same host at the same time.

The new message looks as follows depending on the error:

ERROR: Ping process running as 'ping.exe -n 200 google.com' failed to complete in 5 seconds, full error message: 'This command stopped operation because process "PING (9428)" is not stopped in the specified time-out..'
ERROR: Non-existent EXE for process running as 'blah.exe -n 200 google.com' failed to complete in 5 seconds, full error message: 'This command cannot be run due to the error: The system cannot find the file specified..'

More help is needed to update the other RMM scripts using this powershell

shortcut-integration[bot] commented 1 year ago

This pull request has been linked to Shortcut Story #97501: Update powershell install script to print full error on timeout.