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
Option 1: PowerShell Script (Recommended)
No .NET SDK required. Downloads a self-contained binary from GitHub.
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/bytehide/monitor-dotnet-agent/main/install.ps1))) -Token "bh_xxxxxxxxxxxx"& ([scriptblock]::Create((irm https://raw.githubusercontent.com/bytehide/monitor-dotnet-agent/main/install.ps1))) -Token "bh_xxxxxxxxxxxx"This single command:
- Downloads the
bytehide-agent.exebinary for Windows x64 - Extracts agent DLLs to
C:\Program Files\ByteHide\Agent\ - Sets machine-level environment variables (Registry)
- Installs
bytehide-agent.exetoC:\Program Files\ByteHide\CLI\and adds it to PATH - Loads environment variables into the current PowerShell session
Script Options
| Parameter | Default | Description |
|---|---|---|
-Token | (prompted) | Your ByteHide API token |
-Version | 1.0.5 | Agent version to install |
-InstallDir | C:\Program Files\ByteHide\CLI | Where to place the CLI binary |
-NoInstall | false | Only download binary, don't run install |
Private Hosting
If you host the binary on a private server:
$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"$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.
# Install the CLI tool
dotnet tool install -g Bytehide.Monitor.AgentCli
# Run the agent installer
bytehide-agent install --token bh_xxxxxxxxxxxx# Install the CLI tool
dotnet tool install -g Bytehide.Monitor.AgentCli
# Run the agent installer
bytehide-agent install --token bh_xxxxxxxxxxxxIf using a private NuGet feed:
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_xxxxxxxxxxxxdotnet 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_xxxxxxxxxxxxWhat Gets Installed
| Item | Path |
|---|---|
| Agent DLLs | C:\Program Files\ByteHide\Agent\ |
| CLI binary | C:\Program Files\ByteHide\CLI\bytehide-agent.exe |
| Configuration | C:\Program Files\ByteHide\Agent\monitor.config.json |
| Logs | C:\Program Files\ByteHide\Agent\logs\ |
Environment Variables (Registry, Machine Level)
| Variable | Value |
|---|---|
DOTNET_STARTUP_HOOKS | C:\Program Files\ByteHide\Agent\Bytehide.Monitor.ServerAgent.dll |
ASPNETCORE_HOSTINGSTARTUPASSEMBLIES | Bytehide.Monitor.ServerAgent |
BYTEHIDE_MONITOR_TOKEN | Your token |
BYTEHIDE_MONITOR_CONFIG | C:\Program Files\ByteHide\Agent\monitor.config.json |
Verify Installation
bytehide-agent statusbytehide-agent statusExpected output:
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 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 protectedRestart 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:
<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><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
Check that environment variables are set:
POWERSHELL[Environment]::GetEnvironmentVariable("DOTNET_STARTUP_HOOKS", "Machine")[Environment]::GetEnvironmentVariable("DOTNET_STARTUP_HOOKS", "Machine")Verify the DLL exists:
POWERSHELLTest-Path "C:\Program Files\ByteHide\Agent\Bytehide.Monitor.ServerAgent.dll"Test-Path "C:\Program Files\ByteHide\Agent\Bytehide.Monitor.ServerAgent.dll"Make sure you restarted the application after installing the agent. Existing processes don't pick up Registry changes.
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
- Agent CLI Reference - Manage the agent (status, config, logs, uninstall)
- JSON Configuration - Customize protection rules
- Docker Installation - Install in Docker containers