Skip to main content

Huntress Agent (UNINSTALL)

Summary​

This document outlines the steps to uninstall the Huntress agent from a Windows machine if it is installed.

Dependencies​

  • None. This script can be run on any Windows device.

Create Script​

To implement this script, please create a new PowerShell script.

Image 1
Image 2

Name: Huntress Agent (UNINSTALL)
Description: This task will uninstall the Huntress agent if it is installed on the machine.
Category: Custom

Image 3

Script​

Row 1 Function: PowerShell Script​

Click on "Add Row" and select the PowerShell Script function.

Image 4

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

PowerShell Script

Image 5

Step 2 Logic: If Then Else​

IF Condition​

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

Image 6

ROW 2a Condition: Output Contains​

  • Type Huntress agent is not installed in the Value box.
  • Select another condition with OR operation and type Huntress agent successfully uninstalled in the value box.

Image 7

ROW 2b Function: Script Log​

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

Bash Script 1

Image 8

Step 2c Function: Script Exit​

  • Add another row by selecting the "ADD ROW" button.
  • Search and select the Script Exit function.
  • Leave it blank.

Image 9
Image 10

Step 2d Function: Script Exit​

  • Add another row by selecting the "ADD ROW" button in the Else section.
  • Search and select the Script Exit function.
  • Input the following:

Bash Script 2

Image 11
Image 12

The final task should look like the screenshot below.

Final Task Image

Script Deployment​

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

Go to Automations > Tasks.
Search for "Huntress Agent Install."
Then click on "Schedule" and provide the parameters details as necessary for the script completion.

Image 13

Output​

  • Script log

Changelog​

2025-04-10​

  • Initial version of the document