$ErrorActionPreference = "Stop" $Hub = if ($env:TEMP_REMOTE_TOOL_HUB) { $env:TEMP_REMOTE_TOOL_HUB } else { "https://down.luckyfound.info" } $Token = $env:TEMP_REMOTE_TOOL_AGENT_TOKEN if (-not $Token) { throw "TEMP_REMOTE_TOOL_AGENT_TOKEN required" } if (-not (Get-Command node -ErrorAction SilentlyContinue)) { throw "node required" } $Work = if ($env:TEMP_REMOTE_TOOL_HOME) { $env:TEMP_REMOTE_TOOL_HOME } else { Join-Path $HOME ".temporary_remote_tool\node" } New-Item -ItemType Directory -Force -Path $Work | Out-Null $Js = Join-Path $Work "temporary_remote_tool_client.js" Invoke-WebRequest -Uri ($Hub.TrimEnd("/") + "/install/node-agent.js") -OutFile $Js node $Js agent --hub $Hub --token $Token