How to enable Remote Desktop from 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
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.

This guide will teach you 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 from PowerShell

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 Remote Desktop on Windows 10 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 allow 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 from Windows 10.

Disable Remote Desktop from PowerShell

To disable Remote Desktop from PowerShell on Windows 10, 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.

About the author

Mauro Huculak is a Windows How-To Expert who started Pureinfotech in 2010 as an independent online publication. He has also been a Windows Central contributor for nearly a decade. Mauro has over 14 years of experience writing comprehensive guides and creating professional videos about Windows and software, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 20 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and About.me.