<# NebulaSSH Tunnel Agent - Windows installer (optional). The Windows agent is a GUI app — you can just double-click the .exe and paste your enrollment token in the window. This script is for a scripted/silent install instead: it copies the agent, enrolls it, and enables start-at-logon (runs hidden in the tray). Windows 10/11 : uses the .NET 8 self-contained agent (ConPTY, full ANSI). Windows 7/8 : uses the .NET Framework 4 agent (needs .NET Framework 4.5+, which ships with / is available on every Win7 SP1 box). Usage (PowerShell): .\install-windows.ps1 -EnrollToken NS-XXXXX .\install-windows.ps1 -EnrollToken NS-XXXXX -Relay https://app.nebulassh.com -Framework #> param( [Parameter(Mandatory=$true)][string]$EnrollToken, [string]$Relay = "https://app.nebulassh.com", [switch]$Framework # force the .NET Framework 4 build (Windows 7/8) ) $ErrorActionPreference = "Stop" $here = Split-Path -Parent $MyInvocation.MyCommand.Definition # Pick the build. if ($Framework -or [Environment]::OSVersion.Version.Major -lt 10) { $src = Join-Path $here "dist\net40\nebulassh-tunnel-agent.exe" $edition = ".NET Framework 4 (Windows 7/8)" } else { $rid = if ([Environment]::Is64BitOperatingSystem) { "win-x64" } else { "win-x86" } # arm64 override if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { $rid = "win-arm64" } $src = Join-Path $here "dist\$rid\nebulassh-tunnel-agent.exe" $edition = ".NET 8 ($rid)" } if (!(Test-Path $src)) { throw "Agent binary not found: $src (build it first)." } $dest = Join-Path $env:LOCALAPPDATA "NebulaSSH\tunnel-agent.exe" New-Item -ItemType Directory -Force -Path (Split-Path $dest) | Out-Null Copy-Item $src $dest -Force Write-Host "Installed $edition -> $dest" # Enroll + enable auto-start (agent writes the HKCU Run entry). & $dest --relay $Relay --enroll-token $EnrollToken --install # Launch it now (minimized/silent) so you don't have to reboot. Start-Process -FilePath $dest -ArgumentList "--run","--silent","--relay",$Relay -WindowStyle Hidden Write-Host "" Write-Host "Running. The agent auto-starts at logon and dials out to $Relay." Write-Host "Add a Connector session in the dashboard and pick this machine."