This is my rdp_enable.cmd:
@echo off
FOR /f "tokens=3 skip=2" %%i IN ('reg query "\\%1\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections') DO (set dword=%%i)
echo %DWORD%
if %DWORD%==0x0 goto OFF
goto ON
:ON
reg add "\\%1\HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /f /v fDenyTSConnections /t REG_DWORD /d 0
echo.
echo RDP on host %1 activated
goto EOF
:OFF
reg add "\\%1\HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /f /v fDenyTSConnections /t REG_DWORD /d 1
echo.
echo RDP on host %1 de-activated
goto EOF
:EOF
echo.
echo.
echo press any key
pause>NUL
exit
call rdp_enable.cmd {computer}
loerdy