How to remotely enable remote desktop

Here is a way to remotly enable the remode desktop thanks to psexec.

Configuration

Commands

Windows PsExec | Download link Windows PsExec | Extract zip Windows PsExec | Windows Command move to pstools folder

Enable remote desktop

PS C:\Users\Administrator> PsExec.exe /accepteula \\remote_computer -u administrator reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
PS C:\Users\Administrator> PsExec.exe /accepteula \\remote_computer -u administrator netsh advfirewall firewall add rule name="RDP" dir=in localport=3389 remoteport=0-65535 protocol=TCP action=allow remoteip=any localip=any

Misc

PS C:\Users\Administrator> PsExec.exe /accepteula \\remote_computer -u administrator query termservice
PS C:\Users\Administrator> PsExec.exe /accepteula \\remote_computer -u administrator sc start termservice
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :