Skip to content

Install on Windows

On this page
  1. 1. Download the agent
  2. 2. Give it its token
  3. 3. Create the service
  4. Check it
  5. Logs
  6. Update
  7. Change the token
  8. Proxy and firewall
  9. Uninstall

The agent runs on Windows as a native Windows service. You need an administrator prompt and the agent's token, copied when you created the agent in Onagre.

1. Download the agent#

Windows Agent Checksum
x64 https://d.onag.re/agent-win-x64.exe https://d.onag.re/agent-win-x64.exe.sha256
x86 https://d.onag.re/agent-win-x86.exe https://d.onag.re/agent-win-x86.exe.sha256

In an administrator PowerShell, download it to C:\Program Files\Onagre\ and check it:

PowerShell
New-Item -ItemType Directory -Force "C:\Program Files\Onagre" | Out-Null
Invoke-WebRequest https://d.onag.re/agent-win-x64.exe -OutFile "C:\Program Files\Onagre\agent.exe"
$expected = (Invoke-WebRequest https://d.onag.re/agent-win-x64.exe.sha256).Content.Split(' ')[0].Trim()
(Get-FileHash "C:\Program Files\Onagre\agent.exe" -Algorithm SHA256).Hash -eq $expected

The last command must answer True.

2. Give it its token#

The agent reads its token from the TOKEN environment variable. Set it for the machine, so the service sees it:

Batch
setx TOKEN "<YOUR_TOKEN>" /M

A machine-wide variable is readable by the local users of the server: install the agent on a server where that is acceptable.

3. Create the service#

In an administrator command prompt:

Batch
sc.exe create OnagreAgent binPath= "\"C:\Program Files\Onagre\agent.exe\"" start= auto DisplayName= "Onagre Agent"
sc.exe failure OnagreAgent reset= 86400 actions= restart/5000/restart/5000/restart/5000
sc.exe start OnagreAgent

The service runs as LocalSystem, starts with Windows and restarts after a failure. After a few seconds, the agent shows Connected in Configuration → Agents.

To run it under a dedicated account instead, give that account Read & execute on C:\Program Files\Onagre\ and access to the resources to check, then: sc.exe config OnagreAgent obj= "DOMAIN\svc-onagre" password= "<PASSWORD>".

Check it#

Batch
sc.exe query OnagreAgent
curl http://127.0.0.1:27520/ready

The health endpoints only listen on 127.0.0.1: nothing is exposed to the network.

Logs#

The agent writes one log file per day (4 kept) under %LOCALAPPDATA%\Onagre\ — for the LocalSystem account, C:\Windows\System32\config\systemprofile\AppData\Local\Onagre\. Set a machine-wide LOG variable to write it elsewhere. Service start failures appear in Event Viewer → Windows Logs → System.

Update#

Batch
sc.exe stop OnagreAgent
rem replace C:\Program Files\Onagre\agent.exe with the new version, checked as above
sc.exe start OnagreAgent

Change the token#

After Revoke and regenerate in Onagre, run setx TOKEN "<NEW_TOKEN>" /M, then restart the service.

Proxy and firewall#

The agent needs outbound HTTPS (port 443) to api.onagre.io and to the Hub. If a proxy is mandatory, configure it for the machine or the service account.

Uninstall#

Batch
sc.exe stop OnagreAgent
sc.exe delete OnagreAgent
reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v TOKEN /f

Then delete C:\Program Files\Onagre\.