Skip to main content

Enable Remote Desktop From Command line in Windows

This guide will teach you the steps to use Command Prompt to enable or disable Remote Desktop and open the required firewall ports for a successful connection on Windows 10.

Enable Remote Desktop using Command Prompt

To enable the remote desktop protocol with Command Prompt, use these steps:

  • Open Start on Windows 10.

  • Search for Command Prompt, right-click the top result, and select the Run as administrator option.

  • Type the following command to enable the remote desktop protocol and press Enter:

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
  • (Optional) Type the following command to enable remote desktop through the Windows Firewall and press Enter:
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes

 


 

Disable Remote Desktop using Command Prompt

  • Open Start.

  • Search for Command Prompt, right-click the top result, and select the Run as administrator option.

  • Type the following command to disable the remote desktop protocol and press Enter:

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f
  • (Optional) Type the following command to disable remote desktop through the Windows Firewall and press Enter:
netsh advfirewall firewall set rule group="remote desktop" new enable=No