How to enable Remote Desktop using PowerShell on Windows 10

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

Enable Remote Desktop (RDP) using PowerShell on Windows 10

On Windows 10, the Remote Desktop feature allows you to access a computer remotely to help other users or manage services without physically being present at the location.

While you can manage this feature through the Settings app, you can also enable Remote Desktop on Windows 10 using PowerShell. You may want to use this method to create a script to configure Remote Desktop on multiple devices quickly or send an automated script to users to set up the feature automatically without additional steps.

In this guide, you will learn the steps to use PowerShell to enable (or disable) Remote Desktop on Windows 10 and open the required firewall ports for a successful connection.

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

Enable Remote Desktop using PowerShell on Windows 10

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

  1. Open Start on Windows 10.

  2. Search for PowerShell, 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:

    Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 0

    PowerShell enable Remote Desktop

  4. (Optional) Type the following command to enable remote desktop through the Windows Firewall and press Enter

    Enable-NetFirewallRule -DisplayGroup "Remote Desktop"

Once you complete the steps, you can use the Remote Desktop modern app or the old Remote Desktop Connection app to access your computer remotely, even with the firewall enabled.

Disable Remote Desktop using PowerShell

To disable the remote desktop protocol with PowerShell, use these steps:

  1. Open Start.

  2. Search for PowerShell, 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:

    Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 1

    PowerShell disable Remote Desktop

  4. (Optional) Type the following command to disable remote desktop through the Windows Firewall and press Enter:

    Disable-NetFirewallRule -DisplayGroup "Remote Desktop"

After you complete the steps, the Remote Desktop feature will be disabled, and the firewall port will be closed.

We’re focusing this guide on PowerShell, but you can use these steps to perform the same tasks using Command Prompt.