Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions docs/ninjaone/automations/huntress-agent-manager-windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
id: '518bff20-44d4-4206-9336-bb6922d959da'
slug: /518bff20-44d4-4206-9336-bb6922d959da
title: 'Huntress Agent Manager - Windows'
title_meta: 'Huntress Agent Manager - Windows'
keywords: ['huntress', 'antivirus', 'auto-deploy']
description: 'This script automates the installation, repair, uninstallation, or reinstallation of the Huntress Agent for Windows machines.'
tags: ['antivirus', 'software']
draft: false
unlisted: false
last_update:
date: 2026-06-02
---

## Overview

This script automates the installation, repair, uninstallation, or reinstallation of the Huntress Agent for Windows machines.

## Sample Run

`Play Button` > `Run Automation` > `Script`
![SampleRun1](../../../static/img/docs/b97b3d2c-ecc6-42ff-9236-36b14765c9b7/samplerun1.webp)

Search and select `Huntress Agent Manager - Windows`
![Image1](../../../static/img/docs/518bff20-44d4-4206-9336-bb6922d959da/image1_1.webp)

Set the required arguments and click the `Run` button to run the script.
- **Run As:** `System`
- **Preset Parameter:** `<Leave it Blank>`
- **Huntress Account Key:** `Leave it blank or set this variable to override the value stored in the organization-level custom field 'cPVAL Huntress Account Key'`
- **Huntress Org Key:** `Leave it blank or set this variable to override the value stored in the organization-level custom field 'cPVAL Huntress Org Key'`
- **Huntress Tags:** `Leave it blank or set this variable to override the value stored in the organization-level custom field 'cPVAL Huntress Tags'`
- **Action:** `Install`
![Image2](../../../static/img/docs/518bff20-44d4-4206-9336-bb6922d959da/image2_1.webp)

**Run Automation:** `Yes`
![RunAutomation](../../../static/img/docs/b97b3d2c-ecc6-42ff-9236-36b14765c9b7/runautomation.webp)

## Dependencies

- [Solution : Huntress Agent Deployment](/docs/e0ad73d2-fcab-43f0-9866-72a48623ef48)
- [cPVAL Huntress Account Key](/docs/2b62c710-cd01-4c0a-ab26-58f637e3226a)
- [cPVAL Huntress org Key](/docs/a746555d-f311-449f-ace0-c8a3b67a2ba4)
- [cPVAL Huntress Tags](/docs/ac9bd64b-0327-4879-931d-128936bc43a6)
- [InstallHuntress.powershellv2.ps1](https://raw.githubusercontent.com/huntresslabs/deployment-scripts/main/Powershell/InstallHuntress.powershellv2.ps1)

## Parameters

| Name | Required | Accepted Values | Default | Type | Description |
| ---- | -------- | --------------- | ------- | ---- | ----------- |
| Huntress Account Key | False | | | String/Text | Set this variable to override the value stored in the organization-level custom field [cPVAL Huntress Account Key](/docs/2b62c710-cd01-4c0a-ab26-58f637e3226a) |
| Huntress Org Key | False | | | String/Text | Set this variable to override the value stored in the organization-level custom field [cPVAL Huntress org Key](/docs/a746555d-f311-449f-ace0-c8a3b67a2ba4) |
| Huntress Tags | False | | | String/Text | Set this variable to override the value stored in the organization-level custom field [cPVAL Huntress Tags](/docs/ac9bd64b-0327-4879-931d-128936bc43a6) |
| Action | False | `Install`, `Reregister`, `Reinstall`, `Uninstall`, `Repair` | `Install` | Drop-Down | Choose the action to perform. By default, the script is set to perform installation |

## Automation Setup/Import

[Automation Configuration](https://github.com/ProVal-Tech/ninjarmm/blob/main/scripts/huntress-agent-manager-windows.ps1)

## Output

- Activity Details

## Changelog

### 2026-06-02

- Fixed the powershell to not throw errors if account key is not provided in case of uninstallation.
- Added feature to uninstall the Huntress when required.
- Renamed the script from 'Install Huntress Agent - Windows' to 'Huntress Agent Manager - Windows'
- Updated the document as per our new template.

### 2025-05-30

- Uninstaller was not removing the entries from uninstall registry keys. Added a code-block at the end of the script to fix it.

### 2025-04-11

- Initial version of the document
106 changes: 13 additions & 93 deletions docs/ninjaone/automations/install-huntress-agent-macintosh.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tags: ['antivirus', 'software']
draft: false
unlisted: false
last_update:
date: 2025-05-07
date: 2026-06-02
---

## Overview
Expand All @@ -18,123 +18,43 @@ Deploy Huntress agent on Macintosh machines

## Sample Run

`Play Button` > `Run Automation` > `Script`
`Play Button` > `Run Automation` > `Script`
![SampleRun1](../../../static/img/docs/b97b3d2c-ecc6-42ff-9236-36b14765c9b7/samplerun1.webp)

Search and select `Install Huntress Agent - Macintosh`
Search and select `Install Huntress Agent - Macintosh`
![Image1](../../../static/img/docs/69915d4b-f3e4-4192-b71c-e77559fe9d7f/image1.webp)

Click the `Run` button to run the script.
**Run As:** `System`
**Preset Parameter:** `<Leave it Blank>`
- **Run As:** `System`
- **Preset Parameter:** `<Leave it Blank>`

![Image2](../../../static/img/docs/69915d4b-f3e4-4192-b71c-e77559fe9d7f/image2.webp)

**Run Automation:** `Yes`
**Run Automation:** `Yes`
![RunAutomation](../../../static/img/docs/b97b3d2c-ecc6-42ff-9236-36b14765c9b7/runautomation.webp)

## Dependencies

- [Solution : Huntress Agent Deployment](/docs/e0ad73d2-fcab-43f0-9866-72a48623ef48)
- [cPVAl Huntress Account Key](/docs/2b62c710-cd01-4c0a-ab26-58f637e3226a)
- [cPVAl Huntress org Key](/docs/a746555d-f311-449f-ace0-c8a3b67a2ba4)
- [cPVAl Huntress Tags](/docs/ac9bd64b-0327-4879-931d-128936bc43a6)
- [InstallHuntress-macOS-NinjaRMM.sh](https://raw.githubusercontent.com/huntresslabs/deployment-scripts/main/Powershell/InstallHuntress.powershellv2.ps1)

## Automation Setup/Import

### Step 1

Navigate to `Administration` > `Library` > `Automation`
![Step1](../../../static/img/docs/b97b3d2c-ecc6-42ff-9236-36b14765c9b7/step1.webp)

### Step 2

Locate the `Add` button on the right-hand side of the screen, click on it and click the `New Script` button.
![Step2](../../../static/img/docs/b97b3d2c-ecc6-42ff-9236-36b14765c9b7/step2.webp)

The scripting window will open.
![ScriptingScreen](../../../static/img/docs/b97b3d2c-ecc6-42ff-9236-36b14765c9b7/scriptingscreen.webp)

### Step 3

Configure the `Create Script` section as follows:

**Name:** `Install Huntress Agent - Macintosh`
**Description:** `Deploy Huntress agent on Macintosh machines`
**Categories:** `ProVal`
**Language:** `ShellScript`
**Operating System:** `Mac`
**Architecture:** `64-bit`
**Run As:** `System`
![Image3](../../../static/img/docs/69915d4b-f3e4-4192-b71c-e77559fe9d7f/image3.webp)

## Step 4

Paste the following Shell script in the scripting section:

```bash
#!/bin/bash

# Huntress Installation Script for macOS via NinjaRMM
# With dynamic NinjaRMM CLI path detection

# Determine ninjarmm-cli path
if [ -f "/Applications/NinjaRMMAgent/programdata/ninjarmm-cli" ]; then
ninjarmm_cli="/Applications/NinjaRMMAgent/programdata/ninjarmm-cli"
elif [ -f "/opt/NinjaRMMAgent/programdata/ninjarmm-cli" ]; then
ninjarmm_cli="/opt/NinjaRMMAgent/programdata/ninjarmm-cli"
else
echo "ERROR: ninjarmm-cli not found on this system"
exit 1
fi

# Retrieve Huntress Account Key
accountKey="$($ninjarmm_cli get "cpvalHuntressAccountKey")"

# Validate Account Key exists
if [ -z "$accountKey" ]; then
echo "ERROR: Account Key must be stored in the organization-level custom field 'cPVAL Huntress Account Key'"
exit 1
fi

# Retrieve Organization Key with fallback
organizationKey="$($ninjarmm_cli get "cpvalHuntressOrgKey")"
[ -z "$organizationKey" ] && organizationKey="$NINJA_ORGANIZATION_NAME"

# Define script location and source URL
scriptPath="/tmp/InstallHuntress-macOS-NinjaRMM.sh"
scriptUrl="https://raw.githubusercontent.com/huntresslabs/deployment-scripts/refs/heads/main/Ninja-RMM/InstallHuntress-macOS-NinjaRMM.sh"

# Download installer script
if ! curl -s -o "$scriptPath" "$scriptUrl"; then
echo "ERROR: Failed to download Huntress installation script"
exit 1
fi

# Make executable and run
chmod +x "$scriptPath"
$scriptPath -a "$accountKey" -o "$organizationKey"
```

![Image4](../../../static/img/docs/69915d4b-f3e4-4192-b71c-e77559fe9d7f/image4.webp)

## Saving the Automation

Click the `Save` button in the top-right corner of the screen to save your automation.
![SaveButton](../../../static/img/docs/b97b3d2c-ecc6-42ff-9236-36b14765c9b7/savebutton.webp)

You will be prompted to enter your MFA code. Provide the code and press the Continue button to finalize the process.
![MFA](../../../static/img/docs/b97b3d2c-ecc6-42ff-9236-36b14765c9b7/mfa.webp)

## Completed Automation

![Image5](../../../static/img/docs/69915d4b-f3e4-4192-b71c-e77559fe9d7f/image5.webp)
[Automation Configuration](https://raw.githubusercontent.com/huntresslabs/deployment-scripts/refs/heads/main/Ninja-RMM/InstallHuntress-macOS-NinjaRMM.sh)

## Output

- Activity Details

## Changelog

### 2026-06-02

- Updated the document as per our new template.

### 2025-04-11

- Initial version of the document
Loading
Loading