Skip to main content

Huntress Agent (Re-Register)

Summary

This task re-registers the Huntress Agent in the portal for the endpoint.

Create Script

Please create a new "PowerShell" style script to implement this task.

Image Image

Name: Huntress Agent (Re-Register)
Description: This task re-registers the Huntress Agent in the portal for the endpoint.
Category: Custom

Image

Script

Row 1 Function: Script Log

Image

Input the following:

Bash Script 1

Row 2 Function: Set Pre-defined Variable

  • Select Set Pre-Defined Variable Function

Image

  • Select Custom Field
  • Input acct_key as Variable name
  • Select Huntress Acct_Key custom field from the dropdown
  • Click Save

Image

Row 3 Function: Set Pre-defined Variable

  • Select Set Pre-Defined Variable Function

Image

  • Select Custom Field
  • Input ORG_Key as Variable name
  • Select Huntress Org_Key custom field from the dropdown
  • Click Save

Image

Row 4 Function: Set Pre-defined Variable

  • Select Set Pre-Defined Variable Function

Image

  • Select Custom Field
  • Input Tags as Variable name
  • Select Huntress Tag custom field from the dropdown
  • Click Save

Image

Row 5 Function: PowerShell Script

Image

Paste in the following PowerShell script and set the expected script execution time to 1800 seconds.

PowerShell Script

Image

Step 6 Function: Script Log

  • Add a new row in the If Section of If else then part by clicking the Add Row button
  • Search and select the Script Log function.
  • Input the following

Bash Script 2

Image Image

Step 7 Logic: If/Then

  • Add a new If/Then/Else logic from the Add Logic dropdown menu.

Image

ROW 7a Condition: Output Contains

  • Type denied in 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 Missing in the Value box.

Image

ROW 7b Function: Script Exit

  • Add a new row in the If Section of If else then part by clicking the Add Row button
  • Search and select the Script Exit function.
  • Input the following

Bash Script 3

Image Image

Step 8 Function: Script Log

  • Add a new row in the If Section of If else then part by clicking the Add Row button
  • Search and select the Script Log function.
  • Input the following

Bash Script 4

Image Image

Step 9 Function: Script Exit

  • Add a new row in the If Section of If else then part by clicking the Add Row button
  • Search and select the Script Exit function.
  • Leave it blank

Image Image

Step 10: Complete Script

Image

Script Deployment

For now, the task has been created to run manually on the machines.

Go to Automations > Tasks.
Search for Huntress Agent (Re-Register)
Then click on Schedule and provide the parameters details as necessary for the script completion.

Image

Output

  • Script log

Changelog

2025-04-10

  • Initial version of the document