Raygun Agent command line
Raygun APM 3.x includes a secure command line in the installed RaygunAgent.exe. Use it to inspect Agent health and configure running IIS or supported .NET processes when the Configuration Utility cannot be used, including Windows Server Core.
Run mutating commands from an elevated Administrator prompt. The RaygunAgent service must be running.
$agent = 'C:\Program Files\Raygun\RaygunAgent\Agent3\RaygunAgent.exe'
warning:
Raygun APM 3.x does not ship the retired rgc.exe. Do not use old rgc -register, rgc -enable, rgc -profile, diagnostic, or Agent-tail commands with a current installation.
Check Agent status
& $agent status
& $agent status --json
Discover applications
Start the application and send it one request before discovery so its process exists.
& $agent app discover
& $agent app discover --web-only
& $agent app discover --web-only --json
Use app details to inspect one discovered process:
& $agent app details --process-id 1234
Register and enable an application
Registration saves the application-to-API-key association. It does not enable profiling by itself.
& $agent app register --process-id 1234
& $agent app enable --process-id 1234
The register command prompts for the Raygun application API key without echoing it. For CoreCLR targets, enabling also adds the stable Raygun path to DOTNET_STARTUP_HOOKS while preserving non-Raygun startup-hook entries. Enabling an IIS target recycles its application pool by default so the new worker loads the profiler and, for CoreCLR, the startup hook.
An IIS recycle changes the worker process ID. Run app discover again before a later command that targets the process.
If an IIS pool contains more than one application, registration stops and explains the conflict. Use --allow-shared-pool only when every application in the pool should use the same Raygun API key:
& $agent app register --process-id 1234 --allow-shared-pool
Supply an API key noninteractively
The API key is deliberately not accepted as a command argument or environment variable. Store exactly one line in an ACL-protected local file or retrieve it from the host's secret provider, then pipe it through standard input:
Get-Content -LiteralPath C:\Protected\raygun-api-key.txt -TotalCount 1 |
& $agent app register --process-id 1234 --json
& $agent app enable --process-id 1234 --json
Do not place the API key in command arguments, logs, source control, or a shared machine image.
Disable or remove profiling
Disable profiling but retain the saved association:
& $agent app disable --process-id 1234
Disable profiling and remove the association:
& $agent app unregister --process-id 1234
Both commands recycle IIS by default. Use --recycle false when the operator will restart the application separately:
& $agent app unregister --process-id 1234 --recycle false
A process that already loaded the profiler and startup hook keeps them until that process exits. Disabling or unregistering removes only the Raygun startup-hook path and preserves other entries for the next process start.
Export or import retained settings
& $agent settings export --output C:\Protected\raygun-apm-settings.json
& $agent settings export --output C:\Protected\raygun-apm-settings.json --overwrite
& $agent settings import --input C:\Protected\raygun-apm-settings.json
Exported settings contain protected application information. Keep the file on a local, access-controlled path. Imported applications remain disabled until an explicit app enable command succeeds.
Exit codes
| Exit code | Meaning |
|---|---|
0 |
The requested state is satisfied. |
2 |
Command syntax or an argument is invalid. |
10 |
The local Agent service is unavailable. |
11 |
The process or settings file was not found. |
12 |
The input or runtime is unsupported. |
13 |
Registration, shared-pool, or overwrite conflict. |
14 |
Administrator or local management authorization failed. |
20 |
The operation failed without a safe successful result. |
21 |
State changed, but a follow-up action such as an IIS recycle failed. |
Automation must use the process exit code to determine success. With --json, use changed to distinguish a new change from an idempotent no-op.