Worklet: Install Huntress on Windows Clients

To install Huntress on clients, just put in your Account Key and Organization Key in the remediation.

Evaluation:

$scriptblock = {
    #Define Registry Location for the 64-bit and 32-bit Uninstall keys
    $uninstReg = @('HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall','HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall')

    $appName = 'Huntress Agent'

    # Get all entries that match our criteria. DisplayName matches $appname
    $installed = @(Get-ChildItem $uninstReg -ErrorAction SilentlyContinue | Get-ItemProperty | Where-Object { ($_.DisplayName -match $appName) })

    # If any matches were present, $installed will be populated. If none, then $installed is NULL and this IF statement will be false.
    # The return value here is what the ScriptBlock will send back to us after we run it.
    # 1 for Non-Compliant, 0 for Compliant
    if ($installed) {
        return 0
    } else { return 1 }
}

$exitCode = & "$env:SystemRoot\sysnative\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -WindowStyle Hidden -NoProfile -NonInteractive -Command $scriptblock
Exit $exitCode

Remediation:

$acctkey = 'YOUR_ACCOUNT_KEY'
$orgkey = 'YOUR_ORG_KEY'
‚Äč
(New-Object Net.WebClient).DownloadFile("https://huntress.io/download/$acctkey",$env:temp+'/HuntressInstaller.exe');iex $env:temp"\HuntressInstaller.exe /S /ACCT_KEY=$acctkey /ORG_KEY=$orgkey"