
Remote Desktop (RDP) is the easiest way to connect to a Windows VPS, but leaving it on the default port (3389) makes it a target for brute-force attacks. If you see the error “user account has been locked” when trying to log in, bots are likely hammering your VPS.
Here’s how you can fix the issue and secure your server by changing the RDP port.
Step 1: Access VPS via VNC Console
If your account is locked, use your hosting provider’s VNC/KVM console to log in directly instead of RDP
Step 2: Change RDP Port Using PowerShell
Pick a random port number between 1024–49151 (avoid 3389 and other well-known ports). Example: 4591
or 6123
.
Run this in PowerShell as Administrator:
# Example using random port 4591
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "PortNumber" -Value 4591
# Allow new port in firewall
New-NetFirewallRule -DisplayName "RDP Random Port" -Direction Inbound -Protocol TCP -LocalPort 4591 -Action Allow
Step 3: Disable Old Port (3389)
Remove-NetFirewallRule -DisplayName "Remote Desktop - User Mode (TCP-In)"
Step 4: Restart Services
Restart-Service -Name TermService -Force
If RDP doesn’t reconnect, reboot your VPS:
Restart-Computer
Step 5: Connect with New Port
From your RDP client, connect using your random port:
your-vps-ip:4591
Bonus Security Tips
- Always use complex passwords
- Enable NLA (Network Level Authentication)
- Restrict RDP to your own IP address if possible
- Keep your server patched and updated
Tested on Windows Server 2025 KVM VPS