Enable Remote Desktop and open firewall port on Windows 10
Commands

How to enable Remote Desktop using Command Prompt on Windows 10

You can quickly enable or disable Remote Desktop and firewall on Windows 10 using the Windows Console, and here's how.

On Windows 10, you can use Remote Desktop to access a computer or server remotely to help other users or manage services without having to physically be present at the location.

Although you can manage this feature through the Settings app, you can also enable or disable Remote Desktop on Windows 10 using commands with Command Prompt or PowerShell. You may want to use this method to create a script that you can use to quickly configure Remote Desktop on multiple computers, or send the script to a user, which they can just simply double-click to set up the feature automatically without additional steps.

In this guide, you’ll learn 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.

Important: Remote Desktop is not a feature available on Windows 10 Home, it’s only on Windows 10 Pro and Enterprise. Also, it’s recommended that you do a full backup of your computer before proceeding, as modifying the registry incorrectly can cause irreversible damage to your system.

Enable Remote Desktop using Command Prompt

To enable the remote desktop protocol with Command Prompt, use 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

    Command Prompt enable Remote Desktop
    Command Prompt enable Remote Desktop
  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

    Command Prompt open Remote Desktop firewall port
    Command Prompt open Remote Desktop firewall port

Once you complete the steps, the protocol will enable, and you’ll be able to access the device remotely.

Disable Remote Desktop using Command Prompt

To disable the remote desktop protocol with Command Prompt, use 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

    Command Prompt disable Remote Desktop
    Command Prompt disable Remote Desktop
  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

    Command Prompt close firewall Remote Desktop port
    Command Prompt close firewall Remote Desktop port

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

We’re focusing this guide on Command Prompt, but you can use the same commands to manage the remote desktop protocol using PowerShell.