Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Change the RDP Port in Windows (Registry Method)

Check the current RDP port, change it in the registry, and test the new port.

Windows Hosting2 min read12 steps3 screenshots

Reasons to change the port

Security. Port 3389 is the first one that attackers scan. A different port makes your server less visible to automatic attacks.

Troubleshooting. A different port can help when 3389 is blocked by a network, or used by another service.

Check the current port

Open PowerShell and run:

Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name PortNumber

The default value is 3389 (shown as 3389).

Change the port in the registry

  1. Press Win + R, type regedit and press Enter.
  2. Go to:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
  1. Double-click PortNumber, select Decimal, enter a new port between 1025 and 65535 and click OK.
  2. Some guides also mention TcpPortNumber under Terminal Server\Wds\rdpwd\Tds\tcp. On modern Windows the RDP-Tcp key is enough.
  3. Close the Registry Editor.

Configure the firewall

  1. Press the Windows key, type Windows Defender Firewall with Advanced Security and open it.
    Opening the firewall app
  2. Click Inbound Rules, then New Rule.
    The New Rule button
  3. Select Port and click Next.
  4. Select TCP, choose Specific local ports, type the new port number.
    Entering the port number
  5. Select Allow the connection and click Next.
  6. Select the network types and click Next.
  7. Name the rule and click Finish.

You can also do this in one PowerShell line:

New-NetFirewallRule -DisplayName "RDP custom port" -Direction Inbound -Protocol TCP -LocalPort 3390 -Action Allow

Restart and test

Restart the server (or the Remote Desktop Services service). From another computer, connect with address:port, for example 203.0.113.10:3390.

Troubleshooting

  • Check that the IP address and the port are right.
  • Make sure Windows Firewall, and any firewall of your host or cloud provider, allows the new port.
  • Check that the registry value is in Decimal.
  • Check that the server restarted.
  • If you are locked out, use the console of your VPS panel to fix the settings.

Quick recap

  • Change PortNumber in the RDP-Tcp key.
  • Add a firewall rule for the new port.
  • Restart and connect with address:port.