# Connect to the SKYNET BBS from Windows 11 PowerShell. # Run: irm https://ligand.su/skynet/windows/connect-bbs.ps1 | iex $ErrorActionPreference = 'Stop' function Find-Ssh { $command = Get-Command ssh.exe -ErrorAction SilentlyContinue if ($command) { return $command.Source } $systemSsh = Join-Path $env:WINDIR 'System32\OpenSSH\ssh.exe' if (Test-Path -LiteralPath $systemSsh -PathType Leaf) { return $systemSsh } return $null } $ssh = Find-Ssh if (-not $ssh) { $identity = [Security.Principal.WindowsIdentity]::GetCurrent() $principal = [Security.Principal.WindowsPrincipal]::new($identity) $isAdmin = $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) if (-not $isAdmin) { Write-Host 'OpenSSH Client is missing. Approve the Windows administrator prompt to install it.' $installCommand = '$ErrorActionPreference = "Stop"; try { Add-WindowsCapability -Online -Name "OpenSSH.Client~~~~0.0.1.0" | Out-Null; exit 0 } catch { Write-Error $_; exit 1 }' $encodedCommand = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($installCommand)) $installer = Start-Process -FilePath 'powershell.exe' -ArgumentList @('-NoProfile', '-EncodedCommand', $encodedCommand) -Verb RunAs -Wait -PassThru if ($installer.ExitCode -ne 0) { throw "OpenSSH Client installation failed or was cancelled (exit code $($installer.ExitCode))." } } else { $capability = Get-WindowsCapability -Online -Name 'OpenSSH.Client~~~~0.0.1.0' if ($capability.State -ne 'Installed') { Write-Host 'Installing Windows OpenSSH Client...' $result = Add-WindowsCapability -Online -Name 'OpenSSH.Client~~~~0.0.1.0' if ($result.RestartNeeded) { Write-Warning 'Windows reports that a restart is needed before OpenSSH Client can be used.' } } } $ssh = Find-Ssh if (-not $ssh) { throw 'OpenSSH Client is still unavailable. Restart Windows if prompted, then try again.' } } Write-Host 'Connecting to SKYNET BBS at ligand.su:2223...' & $ssh -p 2223 'new@ligand.su' if ($LASTEXITCODE -ne 0) { throw "SSH exited with code $LASTEXITCODE." }