Step 1: Allow RDP Only From Your IP
The strongest single change is to stop the world from reaching port 3389 at all. Windows Firewall already has rules for Remote Desktop; narrow them to the address you connect from:
Set-NetFirewallRule -DisplayGroup "Remote Desktop" -RemoteAddress 203.0.113.10Replace 203.0.113.10 with your own public IP. Several addresses or a range are fine: -RemoteAddress 203.0.113.10,198.51.100.0/24.
If your home IP changes often, this rule will lock you out the day it changes. Either allow your provider's range, or use Step 5 (a VPN) instead.
Step 2: Make Sure Network Level Authentication Is On
Network Level Authentication (NLA) makes the client prove the password before Windows starts a full desktop session. Without it, every guess costs the server a login screen, and older RDP vulnerabilities become reachable before authentication.
Check it:
(Get-CimInstance -Namespace root/cimv2/TerminalServices -ClassName Win32_TSGeneralSetting -Filter "TerminalName='RDP-tcp'").UserAuthenticationRequired1 means NLA is on. If you see 0, enable it:
Get-CimInstance -Namespace root/cimv2/TerminalServices -ClassName Win32_TSGeneralSetting -Filter "TerminalName='RDP-tcp'" | Invoke-CimMethod -MethodName SetUserAuthenticationRequired -Arguments @{UserAuthenticationRequired=1}Every current RDP client supports NLA, so there is no reason to leave it off.
Step 3: Lock Out Repeated Failures
An account lockout policy turns an endless guessing loop into a handful of attempts. Five failures locks the account for fifteen minutes:
net accounts /lockoutthreshold:5 /lockoutwindow:15 /lockoutduration:15Two things to know before relying on it:
- On older Windows Server versions the built-in Administrator account is exempt from lockout. Step 1 matters more there.
- A lockout policy also locks you out if you mistype your password five times. The browser console still works when that happens.
Step 4: Use a Long, Unique Password
Bots try lists of common and leaked passwords. A random password of 20 or more characters from a password manager is effectively out of reach for them. Never reuse the password from another service, and change the one you received at deploy time if you have shared it anywhere.
Step 5: Put RDP Behind a VPN
The cleanest setup is to close 3389 to the internet completely and reach it through a VPN. WireGuard has a Windows client and works well for this: connect the VPN, then RDP to the server's VPN address.
Once the VPN works, restrict the Remote Desktop rule to the VPN subnet:
Set-NetFirewallRule -DisplayGroup "Remote Desktop" -RemoteAddress 10.8.0.0/24Now port 3389 does not answer anyone on the internet, and the bots move on.
What About Changing the RDP Port?
Moving RDP from 3389 to another port cuts the volume of automated guesses, because most bots only try the default. It does not make the server more secure: anyone scanning all ports finds it in seconds. Treat it as noise reduction on top of Steps 1 to 3, not instead of them.
If you do it, open the new port in the firewall before restarting the service, or you will lock yourself out:
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name PortNumber -Value 3390
New-NetFirewallRule -DisplayName "RDP 3390" -Direction Inbound -Protocol TCP -LocalPort 3390 -Action Allow -RemoteAddress 203.0.113.10
Restart-Service TermService -ForceCheck Who Is Knocking
Failed logons are recorded in the Security log as event 4625. This shows the latest ones:
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4625} -MaxEvents 20 | Format-Table TimeCreated, Message -WrapOn a server with RDP open to everyone, expect a steady stream of them. After Step 1 the list should go quiet.
Keep Windows Updated
Most serious RDP flaws were fixed by Windows Update long before they were widely exploited. Leave automatic updates on, and let the server reboot when it needs to, at a time you choose under Settings, Windows Update, Advanced options.
What It Costs
None of this needs extra software or a bigger server. On our Windows VPS plans the licence is included in the hourly price, starting with the Standard plan (2 vCPU, 4 GB), and the browser console on the server page is there if a firewall change goes wrong.