Sometimes we find ourselves needing to connect to a machine in our corporate network that for one reason or another doesn’t have Remote Desktop Connections enabled. This can be enabled through Group Policy however we might not want to wait for Group Policy to take effect.
To get an immediate result we can use the following method to enable Remote Desktop Connections on a machine in our domain as long as we are a domain admin.
1. Download PSEXEC
PSEXEC is a standalone executable that allows us to run commands on remote computers. It can be downloaded along with the rest of PSTools from http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
2. Copy PSEXEC to System32
Copy the psexec.exe to “C:\WINDOWS\System32\”
3. Enable RDP on the remote machine
Using PSEXEC we can add a registry entry to a remote machine by opening a command prompt as an administrator and executing the following command replacing “MACHINENAME” with the name of the remote machine.
psexec \\MACHINENAME reg add "hklm\system\currentcontrolset\control\terminal server" /f /v fDenyTSConnections /t REG_DWORD /d 0
4. Configure firewall on the remote machine
To open the firewall up to allow remote connections on the remote machine we using the follow commands from an administrator command prompt.
psexec \\MACHINENAME netsh firewall set service remoteadmin enable psexec \\MACHINENAME netsh firewall set service remotedesktop enable
We should now be able to connect to the remote machine via remote desktop.