StudyNext Xeon SSH Log

Xeon側のPowerShell出力や赤いエラーをここに貼って送信。D1に保存されるので、Codex側で確認できます。

パスワード、APIキー、秘密鍵は貼らない。

出力

SSHセットアップ用コマンド

管理者PowerShellで、上から1つずつコピーして実行。赤いエラーが出たら上のフォームに貼って保存。

0. もし >> になっていたら脱出

PowerShell画面で Ctrl + C を押す。これはコピー不要。

1. OpenSSH Serverの状態確認

Get-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

2. NotPresentならインストール

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

3. sshdを起動

Start-Service sshd

4. sshdを自動起動

Set-Service -Name sshd -StartupType Automatic

5. Firewallを開ける

if (-not (Get-NetFirewallRule -Name OpenSSH-Server-In-TCP -ErrorAction SilentlyContinue)) { New-NetFirewallRule -Name OpenSSH-Server-In-TCP -DisplayName "OpenSSH Server (sshd)" -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 }

6. 作業フォルダを作る

New-Item -ItemType Directory -Force C:\StudyNext | Out-Null

7. IPレポートスクリプトを作る

これは少し長いけど1コマンド。貼ってEnter。

Set-Content C:\StudyNext\sn-ip-report.ps1 '$out = "$env:PUBLIC\Desktop\StudyNext-Xeon-IP.txt"'
Add-Content C:\StudyNext\sn-ip-report.ps1 '"=== StudyNext Xeon SSH Info ===" | Set-Content $out'
Add-Content C:\StudyNext\sn-ip-report.ps1 '"Time: $(Get-Date)" | Add-Content $out'
Add-Content C:\StudyNext\sn-ip-report.ps1 '"User: $(whoami)" | Add-Content $out'
Add-Content C:\StudyNext\sn-ip-report.ps1 '"Computer: $env:COMPUTERNAME" | Add-Content $out'
Add-Content C:\StudyNext\sn-ip-report.ps1 '"" | Add-Content $out'
Add-Content C:\StudyNext\sn-ip-report.ps1 '"=== IPv4 ===" | Add-Content $out'
Add-Content C:\StudyNext\sn-ip-report.ps1 'Get-NetIPConfiguration | Where-Object IPv4Address | ForEach-Object { "$($_.InterfaceAlias)  $($_.IPv4Address.IPAddress)" } | Add-Content $out'
Add-Content C:\StudyNext\sn-ip-report.ps1 '"" | Add-Content $out'
Add-Content C:\StudyNext\sn-ip-report.ps1 '"=== ipconfig ===" | Add-Content $out'
Add-Content C:\StudyNext\sn-ip-report.ps1 'ipconfig | Add-Content $out'

8. 起動時にIPレポートを自動作成

schtasks /Create /TN "StudyNext IP Report" /SC ONSTART /TR "powershell -NoProfile -ExecutionPolicy Bypass -File C:\StudyNext\sn-ip-report.ps1" /RL HIGHEST /F

9. 今すぐIPレポートを作る

powershell -NoProfile -ExecutionPolicy Bypass -File C:\StudyNext\sn-ip-report.ps1

10. IPとユーザー名を見る

Get-Content "$env:PUBLIC\Desktop\StudyNext-Xeon-IP.txt"