RDP is the main entry point to your Infrawire Windows VPS. Any service reachable from the internet is probed constantly by automated scans, and Remote Desktop is a favourite target. This guide reduces the attack surface without blocking your own access.
📋 Prerequisites
- Windows VPS with Administrator access
- Working RDP (RDP guide)
- Your current RDP session kept open while you change settings, so that you can undo a mistake
Work through the steps in order and test after each one. A wrong firewall rule or a lost password is much easier to fix while you are still connected.
Enable Network Level Authentication (NLA)
PowerShellSet-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name UserAuthentication -Value 1
With NLA, the client must prove its identity before Windows builds a full desktop session. Anonymous scanners therefore never reach the login screen and cannot use up the server resources. The value 1 turns the requirement on. Read it back to confirm:
PowerShellGet-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name UserAuthentication
The command should return UserAuthentication : 1. Very old RDP clients do not support NLA; if one of them can no longer connect, update the client rather than disabling NLA.
Create a dedicated admin account
Avoid relying only on the default Administrator account.
PowerShell$user = "RdpAdmin" $pass = Read-Host "Strong password" -AsSecureString New-LocalUser -Name $user -Password $pass Add-LocalGroupMember -Group "Administrators" -Member $user
The name Administrator is known to every attacker, so automated attempts only have to guess the password. A custom account name removes half of that guesswork. The script asks for the password without showing it and creates a local user that belongs to the Administrators group. Choose a long, unique password. Before changing anything else, open a second RDP session with the new account and confirm that it works. Only then, if you want to go further, you can disable the default account:
PowerShellDisable-LocalUser -Name "Administrator"
Do this only after the new account has been tested, otherwise you may lock yourself out.
Firewall: allow RDP only
PowerShellGet-NetFirewallRule -DisplayGroup "Remote Desktop" | Set-NetFirewallRule -Enabled True
This enables the predefined Remote Desktop rules, so that RDP is allowed and nothing else is opened for it. If you always connect from a fixed address, restrict the rules to it so that nobody else can even reach the port:
PowerShell# Replace 203.0.113.10 with your own public IP address Get-NetFirewallRule -DisplayGroup "Remote Desktop" | Set-NetFirewallRule -RemoteAddress 203.0.113.10
If your address changes, the next connection will be refused, so keep this for stable addresses and keep an active session open while testing. Optionally, you can also move RDP to another port. It does not stop a targeted attacker, but it removes most of the noise from automated scans. Open the new port first, then change it; the restart of the service ends your current session, so reconnect with address:3390:
PowerShell# Example with port 3390: open the new port first, then change it New-NetFirewallRule -DisplayName "RDP 3390" -Direction Inbound -Protocol TCP -LocalPort 3390 -Action Allow Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name PortNumber -Value 3390 Restart-Service -Name TermService -Force
Once the new port works, disable the default Remote Desktop rule on port 3389.
Our Windows VPS are available in the same 8 locations: Windows VPS France, Windows VPS Germany, Windows VPS Netherlands, Windows VPS United Kingdom, Windows VPS USA, Windows VPS Canada, Windows VPS Turkey and Windows VPS Hong Kong. Desktop editions are offered too: Windows 10 RDP and Windows 11 RDP.
To get an RDP server directly: Buy RDP, Cheap Windows RDP and Streaming RDP.
Account lockout policy
Lock account after several failed attempts via Local Security Policy.
A lockout policy slows down password guessing: after a number of wrong passwords, the account is blocked for a while. You can set it graphically in the Local Security Policy console (secpol.msc), under Account Policies, then Account Lockout Policy, or with a command:
PowerShellnet accounts /lockoutthreshold:5 /lockoutduration:30 /lockoutwindow:30 net accounts
This locks an account for 30 minutes after 5 failed attempts. The second command prints the current policy so you can check it. Remember that the policy also applies to you: if you mistype your password five times, you must wait for the lockout to expire.
Troubleshooting
- The connection is refused after a firewall change: the rule probably does not match your current IP address, or the port is wrong. Fix it from a session that is still open, or contact Infrawire support if none is left.
- Credentials rejected for the new account: confirm that the account was created and that it belongs to the Administrators group (or to Remote Desktop Users for a limited account).
- The client says that NLA is required: update the RDP client, or check that it supports Network Level Authentication.
- The account is locked out: wait for the lockout duration, or unlock it from another administrator account.
- Nothing answers on the new port: check that the firewall rule exists for that port and that the service was restarted.
Secure RDP! 🚀