/

Server Agent - Windows

Install the ByteHide Server Agent on Windows for zero-code runtime protection of all .NET applications. Install once, and every .NET 6+ process on the machine is automatically protected.


Requirements

  • Windows Server 2019, 2022, or 2025 (or Windows 10/11)
  • .NET 6+ runtime installed (for the apps you want to protect)
  • PowerShell running as Administrator
  • A ByteHide account with a Monitor project (create one here)
  • Your ByteHide Project Token from app.bytehide.com

No .NET SDK required. Downloads a self-contained binary from GitHub.

POWERSHELL
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/bytehide/monitor-dotnet-agent/main/install.ps1))) -Token "bh_xxxxxxxxxxxx"

This single command:

  1. Downloads the bytehide-agent.exe binary for Windows x64
  2. Extracts agent DLLs to C:\Program Files\ByteHide\Agent\
  3. Sets machine-level environment variables (Registry)
  4. Installs bytehide-agent.exe to C:\Program Files\ByteHide\CLI\ and adds it to PATH
  5. Loads environment variables into the current PowerShell session

Script Options

ParameterDefaultDescription
-Token(prompted)Your ByteHide API token
-Version1.0.5Agent version to install
-InstallDirC:\Program Files\ByteHide\CLIWhere to place the CLI binary
-NoInstallfalseOnly download binary, don't run install

Private Hosting

If you host the binary on a private server:

POWERSHELL
$env:BYTEHIDE_AGENT_URL = "https://your-server.com/bytehide-agent-1.0.5-win-x64.zip"
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/bytehide/monitor-dotnet-agent/main/install.ps1))) -Token "bh_xxxxxxxxxxxx"

Option 2: dotnet tool

Requires the .NET SDK installed on the server.

POWERSHELL
# Install the CLI tool
dotnet tool install -g Bytehide.Monitor.AgentCli

# Run the agent installer
bytehide-agent install --token bh_xxxxxxxxxxxx

If using a private NuGet feed:

POWERSHELL
dotnet nuget add source "https://pkgs.dev.azure.com/bytehide/Monitor/_packaging/bytehide-monitor-enterprise/nuget/v3/index.json" `
    --name bytehide --username bytehide --password "YOUR_PAT" --store-password-in-clear-text

dotnet tool install -g Bytehide.Monitor.AgentCli --version 1.0.5
bytehide-agent install --token bh_xxxxxxxxxxxx

What Gets Installed

ItemPath
Agent DLLsC:\Program Files\ByteHide\Agent\
CLI binaryC:\Program Files\ByteHide\CLI\bytehide-agent.exe
ConfigurationC:\Program Files\ByteHide\Agent\monitor.config.json
LogsC:\Program Files\ByteHide\Agent\logs\

Environment Variables (Registry, Machine Level)

VariableValue
DOTNET_STARTUP_HOOKSC:\Program Files\ByteHide\Agent\Bytehide.Monitor.ServerAgent.dll
ASPNETCORE_HOSTINGSTARTUPASSEMBLIESBytehide.Monitor.ServerAgent
BYTEHIDE_MONITOR_TOKENYour token
BYTEHIDE_MONITOR_CONFIGC:\Program Files\ByteHide\Agent\monitor.config.json

Verify Installation

POWERSHELL
bytehide-agent status

Expected output:

CODE
  Installed:     Yes
  Install path:  C:\Program Files\ByteHide\Agent
  Agent files:   7 DLLs

  Environment Variables:
    DOTNET_STARTUP_HOOKS = C:\Program Files\ByteHide\Agent\Bytehide.Monitor.ServerAgent.dll
    ASPNETCORE_HOSTINGSTARTUPASSEMBLIES = Bytehide.Monitor.ServerAgent
    BYTEHIDE_MONITOR_TOKEN = bh_xxx...xxxx

  Protection:    Active — all new .NET processes are protected

Restart Required

After installing the agent, you must restart any running .NET applications for protection to take effect. Existing processes do not pick up Registry changes automatically.


IIS Configuration

For IIS-hosted applications, the machine-level environment variables apply automatically. No additional IIS configuration is needed.

If you need to set variables per-application instead of machine-wide, use web.config:

XML
<configuration>
  <system.webServer>
    <aspNetCore>
      <environmentVariables>
        <environmentVariable name="DOTNET_STARTUP_HOOKS" value="C:\Program Files\ByteHide\Agent\Bytehide.Monitor.ServerAgent.dll" />
        <environmentVariable name="ASPNETCORE_HOSTINGSTARTUPASSEMBLIES" value="Bytehide.Monitor.ServerAgent" />
        <environmentVariable name="BYTEHIDE_MONITOR_TOKEN" value="bh_xxxxxxxxxxxx" />
      </environmentVariables>
    </aspNetCore>
  </system.webServer>
</configuration>

Troubleshooting

Agent not loading

  1. Check that environment variables are set:

    POWERSHELL
    [Environment]::GetEnvironmentVariable("DOTNET_STARTUP_HOOKS", "Machine")
  2. Verify the DLL exists:

    POWERSHELL
    Test-Path "C:\Program Files\ByteHide\Agent\Bytehide.Monitor.ServerAgent.dll"
  3. Make sure you restarted the application after installing the agent. Existing processes don't pick up Registry changes.

  4. For the current PowerShell session, env vars are loaded automatically by install.ps1. If you opened a new terminal after install, the vars are inherited from the Registry.

Permission errors during install

Run PowerShell as Administrator. The installer needs admin rights to write to C:\Program Files\ and set machine-level environment variables in the Registry.

Antivirus blocking

If Windows Defender or another antivirus blocks the agent DLLs, add an exclusion for C:\Program Files\ByteHide\Agent\.


Next Steps

Previous
Overview