@echo off :: Setup OpenSSH Server on port 61374 :: Run as Administrator! echo === Installing OpenSSH Server === powershell -Command "Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0" echo === Starting sshd to generate config === powershell -Command "Start-Service sshd; Stop-Service sshd" set CFG=C:\ProgramData\ssh\sshd_config echo === Setting port 61374 === powershell -Command "(Get-Content '%CFG%') -replace '^#?Port\s+\d+', 'Port 61374' | Set-Content '%CFG%'" echo === Enabling password auth === powershell -Command "(Get-Content '%CFG%') -replace '^#?PasswordAuthentication\s+\w+', 'PasswordAuthentication yes' | Set-Content '%CFG%'" echo === Opening firewall port 61374 === powershell -Command "New-NetFirewallRule -Name 'OpenSSH-Server-61374' -DisplayName 'OpenSSH Server (port 61374)' -Direction Inbound -Protocol TCP -LocalPort 61374 -Action Allow" echo === Starting sshd + autostart === powershell -Command "Start-Service sshd; Set-Service -Name sshd -StartupType Automatic" echo === Verifying === powershell -Command "netstat -an | Select-String '61374'" echo. echo Done! SSH listening on port 61374 pause