How to Change the RDP Port in Windows 10, 11, and Windows Server
If a Windows PC or Windows Server is exposed to the internet over Remote Desktop (RDP), automated brute-force bots hammer default port 3389 around the clock. Moving RDP to a custom port isn’t a replacement for a VPN, yet it instantly cuts out 99% of noisy login spam in your security event logs.

The exact same registry value works across every version of Windows – from classic Windows XP and Server 2008/2012 right through Windows 10, 11, and Windows Server 2019/2022/2025.
Method 1. Via Registry Editor (regedit)
- Open Registry Editor: press
Win + R, typeregedit, and hit Enter. - Navigate to RDP-Tcp: open
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp. - Edit PortNumber: double-click
PortNumberon the right, switch the base to Decimal, and enter your chosen free port (for example33890– ideally somewhere in the 10000–65000 range). - Allow the port in Windows Firewall: run
wf.msc-> Inbound Rules -> New Rule -> Port -> TCP (and optionally a second rule for UDP transport) -> enter33890-> Allow the connection.
Method 2. Fast PowerShell Script (Registry + Firewall + Restart)
On Windows 10/11 or Windows Server, four lines in an elevated PowerShell prompt handle everything cleanly (replace 33890 with your preferred port):
$port = 33890 Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "PortNumber" -Value $port New-NetFirewallRule -DisplayName "RDP Custom TCP $port" -Direction Inbound -Protocol TCP -LocalPort $port -Action Allow New-NetFirewallRule -DisplayName "RDP Custom UDP $port" -Direction Inbound -Protocol UDP -LocalPort $port -Action Allow Restart-Service TermService -Force
How to Connect After Changing the Port
You don’t need a full server reboot – restarting TermService applies the new port immediately (your current RDP window will briefly disconnect). In Remote Desktop Connection (mstsc), append the new port after a colon:
203.0.113.10:33890
For real production security, still put RDP behind WireGuard or Tailscale – or restrict the inbound firewall rule strictly to your own static IP address.