How to change default RDP port for Remote Desktop Connection

You can connect to either a Windows client or Windows server through Removet Desktop Connection. By default, Remote Desktop Connection hears the connection request on port 3389. However, you can change the listing RDP port by modifying the registry on Windows.

In this guide, we will show you how to change the default RDP port for the Remote Desktop connection. Follow the below steps to do this.

Change default RDP Port

  1. Open the Run box by using Windows+R shortcut key on the keybaord.
  2. Type regedit.exe in the Run box, then hit the enter button.
  3. This opens Registry Editor.
  4. In the Registry Editor, naviagte to the following registry subkey: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
  5. Find the PortNumber.
rdp port
  1. Right-click on it, then select Modify.
  2. Select the Base as Decimal.
  3. The default port value should be 3389, you can edit this.
remote desktop port
RDP Port 3389
  1. Then, click the OK.
  2. Exit the Registry Editor, and then Restart the computer.

Next time when you connect to a computer through a Remote Desktop connection, you need to use this new port to establish the connection. If you’re using a firewall, then make sure the following port is configured on the firewall to allow inbound connection requests.

To check the current RDP port, run the following command in the PowerShell window.

Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber"

The output should be the following:

rdp port
PortNumber   : 3389
PSPath       : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations
PSChildName  : RDP-Tcp
PSDrive      : HKLM
PSProvider   : Microsoft.PowerShell.Core\Registry

You can also change the RDP port by running the following command in the PowerShell. Here, I am using the port value 3390.

By running this command, we will add a new RDP port to the registry.

$portvalue = 3390

Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber" -Value $portvalue 

New-NetFirewallRule -DisplayName 'RDPPORTLatest-TCP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol TCP -LocalPort $portvalue 
New-NetFirewallRule -DisplayName 'RDPPORTLatest-UDP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol UDP -LocalPort $portvalue

After following the above steps, I hope you have successfully changed the RDP port for Remote Desktop Connection. If you’re having any problem changing the RDP port, feel free to comment below.

Leave your reply here

Scroll to Top