SSH Setup Batch Script #batchscript #tools
@echo off
echo Checking if running as administrator...
net session >nul 2>&1
if %errorLevel% neq 0 (
echo Please run this script as Administrator.
pause
exit /b
)
echo Installing OpenSSH Server...
dism /Online /Add-Capability /CapabilityName:OpenSSH.Server~~~~0.0.1.0
echo Starting SSH service...
net start sshd
echo Enabling SSH service to start automatically...
sc config sshd start=auto
echo Allowing SSH through Windows Firewall...
netsh advfirewall firewall add rule name="OpenSSH" dir=in action=allow protocol=TCP localport=22
echo Checking SSH service status...
sc query sshd
echo SSH setup completed successfully.
pause
exit
Comments
Post a Comment