Remote access

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 having to physically be present at the location.

While you can manage this feature through the Settings app, you can also enable or disable Remote Desktop on Windows 10 using PowerShell. You may want to use this method to create a script that you can use to quickly configure Remote Desktop on multiple devices, 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 PowerShell to enable or disable Remote Desktop on Windows 10, and the steps to 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 incorrectly can cause irreversible damage to your system.

How to enable Remote Desktop using PowerShell

Use these steps to enable the remote desktop protocol with PowerShell:

  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

    Enable Remote Desktop using PowerShell
    Enable Remote Desktop using PowerShell
  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’ll be able to use the Remote Desktop modern app or the old Remote Desktop Connection app to access your computer remotely even with the firewall enabled.

How to disable Remote Desktop using PowerShell

Use these steps to disable the remote desktop protocol with PowerShell:

  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

    Disable Remote Desktop using PowerShell
    Disable Remote Desktop using PowerShell
  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.