Huntress Agent (Reinstall)
Summary
This task reinstalls the Huntress Agent.
Create Script
Please create a new PowerShell style script to implement this task.
Name: Huntress Agent (ReInstall)
Description: This task reinstalls the Huntress Agent.
Category: Custom
Script
Row 1 Function: Script Log
Input the following:
The script will detect the required keys for the Huntress reinstallation:
Row 2 Function: Set Pre-defined Variable
- Select
Set Pre-Defined VariableFunction
- Select
Custom Field - Input
acct_keyas Variable name - Select
Huntress Acct_Keycustom field from the dropdown - Click Save
Row 3 Function: Set Pre-defined Variable
- Select
Set Pre-Defined VariableFunction
- Select
Custom Field - Input
ORG_Keyas Variable name - Select
Huntress Org_Keycustom field from the dropdown - Click Save
Row 4 Function: Set Pre-defined Variable
- Select
Set Pre-Defined VariableFunction
- Select
Custom Field - Input
Tagsas Variable name - Select
Huntress Tagcustom field from the dropdown - Click Save
Row 5 Function: PowerShell Script
Paste in the following PowerShell script and set the expected script execution time to 900 seconds.

Step 6 Function: Script Log
- Add a new row in the If Section of the If-Else block by clicking the Add Row button
- Search and select the
Script Logfunction. - Input the following
%Output%
Step 7 Logic: If/Then
- Add a new
If/Then/Elselogic from the Add Logic dropdown menu.
Row 7a Condition: Output Contains
- Type
deniedin the Value box. - Add another condition with the OR operator and type
ERROR:in the Value box. - Add another condition with the OR operator and type
Account Key Missingin the Value box.
Row 7b Function: Script Exit
- Add a new row in the If Section of the If-Else block by clicking the Add Row button
- Search and select the
Script Exitfunction. - Input the following
Failed to repair Huntress Agent. Command Result: %Output%
Step 8 Function: Script Log
- Add a new row in the If Section of the If-Else block by clicking the Add Row button
- Search and select the
Script Logfunction. - Input the following
Successfully repaired Huntress Agent.
Step 9 Function: Script Exit
- Add a new row in the If Section of the If-Else block by clicking the Add Row button
- Search and select the
Script Exitfunction. - Leave it blank
Step 10: Complete Script

Script Deployment
For now, the task has been created to run manually on the machines.
Go to Automations > Tasks.
Search for Huntress Agent (ReInstall).
Then click on Schedule and provide the parameters details as necessary for the script completion.

Output
- Script log
Changelog
2025-04-10
- Initial version of the document