Enabling RDP, or installing a VNC server, on Windows 7 from the command line

Solution 1:

You can enable RDP with the following commands:

C:\>netsh firewall set service remoteadmin enable
C:\>netsh firewall set service remotedesktop enable

Alternatively you can also modify the remote registry with the following command:

C:\>reg add "HKLM\system\currentcontrolset\control\terminal server" /v fDenyTSConnections /t REG_DWORD /d 0

Value fDenyTSConnections exists, overwrite(Y/N)? y

The operation completed successfully

Solution 2:

The Reg Add command works perfectly when using PSEXEC on remote machines

c:\PSTools> psexec \\[computername] reg add "HKLM\system\currentconminal server" /v fDenyTSConnections /t REG_DWORD /d 0

Command should return the following:

PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com


Value fDenyTSConnections exists, overwrite(Yes/No)? y
The operation completed successfully.
reg exited on [computername] with error code 0.