This is an old revision of the document!
http://serverfault.com/questions/364858/disable-remote-desktop-through-cmd-or-script-in-windows-2008
To disable remote desktop from Windows command line, run the below command as administrator:
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f
To enable remote desktop from Windows command line, run the following command as administrator:
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f