Huntress: Huntress Managed Endpoint Detection and Response
Product: Ninja RMM
Environment: Windows
Summary: This article describes how to deploy the Huntress Agent to your organizations' computers using a Scheduled Script or Manual Script Install within your NinjaOne Policies.
This script uses the NinjaOne platform to automate the deployment process. We are unable to offer comprehensive support for NinjaOne; please refer to the NinjaOne documentation for full details regarding the usage of their policies and scheduled scripts.
In This Article
Before You Begin
Retrieve Your Huntress Account Key
Download, Edit, and Import the Huntress Deployment Script
Add a Scheduled Script to Your Policy
Manually Run the Script on a Device
Troubleshooting
Before You Begin
Make sure you have the following ready before starting this process:
- Access to the Huntress Platform to retrieve your Account Key.
- Access to your NinjaOne dashboard. Note that we recommend using NinjaOne's Global Custom Field feature to store your Account Key.
- The Organization Key for deployment will match the organization (site) name used in NinjaOne (from the Dashboard > Organizations).
Retrieve Your Huntress Account Key
- Log in to Huntress as an Account user (User, Security Engineer, or Admin).
-
From the Hamburger drop down menu, go to the Download Agent page.
- Expand the View Installation Guides view of the MDM, RMM, or Group Policy section and copy your Account Key.
If needed, make note of your Organization Key (if hardcoding your script) and any Agent Tags you may want to use.
Download, Edit, and Import the Huntress Deployment Script
-
Download our PowerShell Deployment Script.
Running an older script my cause deployment errors. Ensure you are using the latest script.
- In your NinjaOne dashboard, navigate to Administration.
- In the left-hand menu, expand Library > Automation.
- Click the Add automation button, then select New Script in the upper-right area.
- Paste the entire PowerShell script into the left-hand pane.
-
Configure your script options in the right-hand pane.
Note: You may use custom values for Name, Description, and Category, but Language must be PowerShell and Architecture must be set to All.
Example:- Name: Huntress - Deploy Agent [PS]
- Description: Deploy Huntress Agent via PowerShell
- Category: Security
- *Language: PowerShell
- Operating System: Windows
- *Architecture: All
-
Run As: System
-
Edit the script to include your Account Key
Option 1: Recommended Method (Use a Script Variable):
-
Add a mandatory text type Script Variable that contains your Account Key. We suggest naming the field something like HuntressInstallKey, with the default value set as your Account Key. The type must be mandatory. Use the following for lines 49-52 instead of hard-coding the key:
$AccountKey = "__ACCOUNT_KEY__" if ( $null -ne $env:huntressinstallkey ){ $AccountKey = $env:huntressinstallkey }
-
Option 2: Alternative Method (Hardcoded Key): Locate line 49 and paste your Account Key over the __ACCOUNT KEY__ text in the script.
-
Locate line 52 (line 55 if you are using the Script Variable) of the script. In both methods, the Organization Key is provided by the environmental variable which should automatically pull the organization name from Ninja RMM directly.
$env:NINJA_ORGANIZATION_NAMENote: While not recommend, you may opt to hard code the Organization Key into your script. As each organization has a different Organization Key, doing this method means that a new script would need to be built per organization.
9. Optional: Line 55 (line 58 if you are using the script variable) will allow you to add a tag to apply to your installed agents.
10. Click the save button in the upper-right corner of the script editor.
Add a Scheduled Script to Your Policy
This section is a general guideline. You may want to add the Huntress script to one or more custom policies in your deployment. We are unable to offer comprehensive support for NinjaOne; refer to the NinjaOne documentation for full details regarding the usage of policies and scheduled scripts.
- Log in to NinjaOne.
- Navigate to the policy you want to use by clicking Administration > Policies > Agent Policies > [Policy Name]. You can also create a new policy. (Example we will use is Windows Workstation policy).
- Click on the Scheduled Automations menu on the left, then click Add a Scheduled Automation on the right.
- In the Scheduled Script window, choose an appropriate name and description for the script.
- Set the Schedule and Notification preferences to your preferred settings.
- Click the Add automations button to add an automation.
- Select the script you created in the previous section.
- Leave the Preset Parameter field blank and set Run As to System.
- Click Apply, then click Add to add the script to the schedule.
- Click Save in the upper-right corner.
The Huntress Agent is now ready to be deployed via NinjaOne!
Manually Run the Script on a Device
- From your NinjaOne Devices dashboard, select the device(s) you wish to run your script on. You can filter devices or select all devices to run the script in bulk.
- Click the Run button (the play button) on the device, or the Run button at the top of the page.
- Select Automation, then select Script.
- Click on the name of the script you want to run.
- Set it to run as System if it is not already.
- Click Run to execute the script immediately.
- Follow any additional prompts to begin the script and monitor for installation completion.
Troubleshooting
- From your NinjaOne Dashboard, click on Activities > All.
- Find the Completed action and click on the description for more details
- The resulting pop-up should describe the issue.
- A common issue is an incorrect or missing Account Key or Organization Key.
- If you receive an output that suggests a WMI issue on the endpoint, try restarting WMI (Windows Management Instrumentation) and/or the endpoint. If the issue persists, refer to the Microsoft troubleshooting guide for WMI.
- If you see a successfully installed message like the example below, and you still don't see the agent in your portal make sure you're searching from your Account level dashboard, not your Organization level dashboard. It is possible a new organization was accidentally created. To correct this, move the agents from the old organization into the new one matching the site name in NinjaRMM and delete the old organization from your Huntress portal.
Additionally, ensure the only section of the script you modify is the section between lines 45 "Begin user modified variables section" and lines 72/75 where it notes "Do not modify anything below this line." If any modifications were made to any other sections of the script, installation is likely to fail.
If you're still stuck, email your Huntress log files from the affected machine's NinjaOne script, from c:\Windows\temp\ and/or c:\Program Files\Huntress\ to support@huntress.io.