How to enable RDP remotely with psexec pstools
If a computer is on your network, but RDP is not enabled, you can create a group policy to enable it and then restart the computer. Or instead, you can use psexec to remotely enable RDP.
Below are a couple one-line scripts to enable RDP on a remote computer from a different computer on the same domain. Keep in mind you need to be an administrator and you will only enable RDP for yourself, not an entire security group.
- Download the pstools to your computer from here and unzip them into a folder named pstools at the root of your c: drive.
- Open the command prompt as administrator.
- Change directory into c:\pstools then run the command:
psexec \\hostname.contoso.com reg add "hklm\system\currentcontrolset\control\terminal server" /f /v fDenyTSConnections /t REG_DWORD /d 0
4. Run another command to open the required ports in the firewall on the remote machine
psexec \\hostname.contoso.com netsh firewall set service remoteadmin enable
5. RDP into the remote machine with mstsc.exe successfully!