categories
Updated on in

Enable RDP – PowerShell Registry Commands

Author: Helga York
Helga York Article author

If you are a Windows administrator, you may encounter the need to enable RDP via PowerShell. A PowerShell session is one of the few ways to enable Remote Desktop remotely on a Windows 11 computer. Even if you’re configuring it locally, a set of PowerShell commands is faster to run than manually digging around in the Registry Editor. 

Note:  This is a Windows 11 guide. You can find information on Remote Desktop (RDP) in Windows 10 by following this link.

In addition to commands to enable RDP, this article also features commands to disable it, or to run a PowerShell check if RDP is enabled.

How to Enable RDP via PowerShell

  1. Open PowerShell by pressing Win+X and selecting “Terminal (Admin)”.

    Opening PowerShell on Windows 11
  2. If you’re trying to enable PowerShell remotely, use the Enter-PSSession command to connect to a remote computer.

  3. Run the following commands:

    Set-ItemProperty -Path `
    ‘HKLM:\System\CurrentControlSet\Control\Terminal Server’ `
    -name “fDenyTSConnections” -value 0

    Set-ItemProperty -Path `
    “HKLM:\SYSTEM\CurrentControlSet\Control\Terminal
    Server\WinStations\RDP-Tcp” `
    -Name “UserAuthentication” -Value 1

    The latter command is for additional safety, since it prevents unauthorized RDP access to the remote computer.

    Changing the Windows Registry with commands
  4. Run the command Enable-NetFirewallRule -DisplayGroup “Remote Desktop” to allow RDP sessions through the Windows Firewall.

The computer is now ready for RDP access.

Additional PowerShell RDP Hints

Once you have PowerShell enable RDP, disabling it is just as easy. The commands are reversed:

Set-ItemProperty -Path`
‘HKLM:\System\CurrentControlSet\Control\Terminal Server’ `
-name “fDenyTSConnections” -value 0
Disable-NetFirewallRule -DisplayGroup “Remote Desktop”

Reversing the Registry RDP commands

There are also multiple ways to check if it’s enabled. One way is to manually go to the “Local Machine\System\CurrentControlSet\Control\Terminal Server” key in the Registry Editor and look at the value:

Checking the keys manually

Alternatively, you can do a PowerShell check if RDP is enabled:

Get-ItemProperty -Path `
‘HKLM:\System\CurrentControlSet\Control\Terminal Server’ `
-name “fDenyTSConnections”

Get-ItemProperty output

This is a PowerShell tutorial, but you can also enable RDP with the help of the command line, which can be helpful under specific circumstances. Additionally, if you have a domain set up, consider using group policies to enable RDP.