How to enable RDP remotely with psexec pstools
If a computer is powered up on your network, but RDP is not enabled, you can create a group policy to enable RDP, 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 the sysinternals download site 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 (where the pstools files are located) then run the command:
psexec64 -u domain\administrator -p "P@ssw0rd" \\remotecomputername.domain.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
psexec64 -u domain\administrator -p "P@ssw0rd" \\remotecomputername.domain.com netsh firewall set service remoteadmin enable
5. RDP into the remote machine with mstsc.exe successfully, and that’s it!