Team: Huntress EDR
Product: PowerShell 2.0+
Environment: Windows Server 2008 and newer, Windows Vista and newer
Summary: Automated Huntress agent deployment via PoSh (Power Shell scripts)
Deploying the Huntress Agent using PowerShell
This PowerShell script will install the Huntress Agent. The script will automatically download the newest installer from the Huntress servers and run it. You have the option to hard code your Huntress account key and the organization key in the script or pass either as an argument to the script. This script should be run as Admin.
If you've previously used our legacy script v1, please make sure you update all your scripts to v2 (InstallHuntress.powershellv2.ps1) so you can take advantage of all the new features (new batch file wrapper too!).
The script supports the following mutually exclusive command-line switches:
-reregister- Force the agent to re-register (useful if previously deployed with the incorrect account key, orphaned agent, or performing a full repair)
-reinstall- Re-install the agent (useful for a quick repair of an agent)
-uninstall- Uninstalls the agent aggressively, useful for agents struggling to uninstall normally.
Passing parameters (command line switches):
powershell -executionpolicy bypass -f ./InstallHuntress.powershellv2.ps1 [-acctkey <account_key>] [-orgkey <organization_key>] [-tags <comma_separated_tags>] [-reregister] [-reinstall] [-uninstall]
Replace the <account_key> and <organization_key> with your Account and Organization Keys
powershell -executionpolicy bypass -f ./InstallHuntress.powershellv2.ps1 -acctkey <account_key> -orgkey <organization_key> -tags "production, USWest"
Hard coding keys:
Hard coding keys isn't generally recommended as it exposes your account key and can break the deploy script if done incorrectly. That said, if you're using "Version 2, major revision 7, 2023 May 1" (search for $ScriptVersion to find your version) you can simply edit lines 47 and 50 to contain your account and org keys.
Batch File Wrapper
We have also included a batch file,
InstallHuntress.bat, to be used as a wrapper. This is useful if your RMM/SCCM application does not manage the PowerShell ExecutionPolicy or pass parameters.
You'll need to edit the batch file (found on our github), adding your Huntress account key. Then you can run the batch file as follows:
InstallHuntress.bat <organization_key> <optional_tags>