How to enable Remote Desktop using Command Prompt on Windows 10

You can enable or disable Remote Desktop and configure the firewall ports on Windows 10 with commands, and here's how.

Windows 10 Remote Desktop enabled with CMD
Windows 10 Remote Desktop enabled with CMD / Image: Mauro Huculak
  • To enable Remote Desktop on Windows 10, open Command Prompt (admin) and run the “reg add “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server” /v fDenyTSConnections /t REG_DWORD /d 0 /f” and “netsh advfirewall firewall set rule group=”remote desktop” new enable=Yes” commands.

UPDATED 7/30/2025: On Windows 10, you can enable Remote Desktop to remotely access a device to provide support or manage a system without being physically present.

While the feature is available through the Settings app, you can also turn Remote Desktop on or off using Command Prompt or PowerShell. This method is useful for scripting deployments across multiple devices or sending a quick setup script to another user.

In this guide, I’ll outline 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. (These instructions should also work on Windows 11.)

Important: Remote Desktop is not a feature available on Windows 10 Home. It is only available on Windows 10 Pro, Enterprise, and Education. It is also recommended that you create a full backup of your computer before proceeding, as modifying the registry can cause irreversible damage to your system.

Enable Remote Desktop from Command Prompt

To enable the Remote Desktop Protocol with Command Prompt, follow these steps:

  1. Open Start on Windows 10.

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

  3. 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

    Remote Desktop enable command

  4. (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

Once you complete the steps, the protocol will be enabled on Windows 10, and you will be able to access the device remotely.

Disable Remote Desktop from Command Prompt

To turn off the Remote Desktop Protocol with Command Prompt, follow these steps:

  1. Open Start.

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

  3. 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

    Remote Desktop disable command

  4. (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

After you complete the steps, the Remote Desktop service will be turned off, and the Windows Firewall port will be closed.

This guide focuses on Command Prompt, but you can use the same commands to manage the Remote Desktop Protocol using PowerShell. However, you can always use PowerShell-specific commands to manage RDP on your computer.

About the author

Mauro Huculak is a Windows How-To Expert and founder of Pureinfotech in 2010. With over 22 years as a technology writer and IT Specialist, Mauro specializes in Windows, software, and cross-platform systems such as Linux, Android, and macOS.

Certifications: Microsoft Certified Solutions Associate (MCSA), Cisco Certified Network Professional (CCNP), VMware Certified Professional (VCP), and CompTIA A+ and Network+.

Mauro is a recognized Microsoft MVP and has also been a long-time contributor to Windows Central.

You can follow him on YouTube, Threads, BlueSky, X (Twitter), LinkedIn and About.me. Email him at [email protected].