Your Windows account keeps locking? Bots scan the internet and guess passwords on the default RDP port 3389. This tutorial explains the mechanism and how to change the Remote Desktop port for stable access.
See also: Connect via RDP · Secure RDP
📋 Prerequisites
- Windows VPS with Administrator access (active RDP session)
- Working RDP connection before changes
What is going on?
The default RDP port is 3389. Bots know it and scan it continuously. After many failed login attempts, Windows locks the account.
Default RDP port (3389) — attack in progressInternet botsadmin / 123456✕admin / password✕admin / qwerty✕… × 500 attempts✕Windows VPSPort 3389Account lockedYouConnection deniedConnection denied
After changing the port, bots no longer find RDP on 3389:
Custom port (e.g. 3390) — bots blockedInternet botsPort 3389Port closedScan fails
YouPort 3390Windows VPSConnected
Step 1 — Change the port in the registry
Open PowerShell as Administrator:
PowerShellSet-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name PortNumber -Value 3390
Replace 3390 with your chosen port (1024–65535).
Via regedit:
Win + R→regedit- Go to
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp - Double-click PortNumber → select Decimal → enter
3390→ OK
Step 2 — Open the new port in the firewall
PowerShellNew-NetFirewallRule -DisplayName "RDP Custom Port" -Direction Inbound -Protocol TCP -LocalPort 3390 -Action Allow
See also: open a Windows firewall port.
Step 3 — Restart the RDP service
PowerShellRestart-Service TermService -Force
Step 4 — Connect with the new port
In Remote Desktop, use:
TEXTYOUR_IP:3390
Example: 82.26.157.98:3390
⚠️ Do not close your current session until the new port works.
Step 5 — Block the old port (optional)
After confirming the new connection:
PowerShellNew-NetFirewallRule -DisplayName "Block RDP 3389" -Direction Inbound -Protocol TCP -LocalPort 3389 -Action Block
Verify
PowerShellnetstat -an | findstr "3390"
Expected:
TEXTTCP 0.0.0.0:3390 0.0.0.0:0 LISTENING
Go further
Restrict access to your fixed public IP only:
PowerShellNew-NetFirewallRule -DisplayName "RDP My IP" -Direction Inbound -Protocol TCP -LocalPort 3390 -RemoteAddress "YOUR_IP_HERE" -Action Allow New-NetFirewallRule -DisplayName "RDP Block Rest" -Direction Inbound -Protocol TCP -LocalPort 3390 -Action Block
Only if your IP is static — otherwise you may lock yourself out.
Summary
| Action | Command |
|---|---|
| Change port | Set-ItemProperty -Path "HKLM:\...\RDP-Tcp" -Name PortNumber -Value 3390 |
| Open firewall | New-NetFirewallRule ... -LocalPort 3390 -Action Allow |
| Restart RDP | Restart-Service TermService -Force |
| Verify | netstat -an | findstr "3390" |
| Block old port | New-NetFirewallRule ... -LocalPort 3389 -Action Block |
Secure RDP access! 🚀