Put a Windows Server on a public IP with Remote Desktop open on port 3389, and within minutes the Security log starts filling with failed logins for administrator, admin, user and friends. Bots scan the whole IPv4 range all day; they are not looking for you, they are looking for anyone.

None of that is a reason to panic. It is a reason to spend 15 minutes on the basics before you install anything else. This guide is for a fresh Windows Server 2019/2022/2025 VPS that you reach with Remote Desktop as administrator.

Before you start: find out how to reach the server's console without RDP (most VPS hosts have a "console" or "VNC" button in their panel). If a firewall change locks you out, that console is how you get back in.

All commands below run in PowerShell as Administrator on the server, and assume an English-language Windows install (names like Administrators and the firewall group names are translated on other languages).

1. Change the password you were given

The first password was shown in a panel or sent by email, so treat it as already seen. In your RDP session press Ctrl+Alt+End (the RDP version of Ctrl+Alt+Del) and choose Change a password.

Use a long passphrase (four or five random words, 20+ characters) and keep it in a password manager. Length beats clever symbols, and bots mostly try short, common passwords.

2. Make your own admin account

Every bot on the internet guesses the username administrator. Give yourself an account they have to guess too:

$pw = Read-Host -AsSecureString "Password for the new account" New-LocalUser -Name "ops-anna" -Password $pw Add-LocalGroupMember -Group "Administrators" -Member "ops-anna" 

Pick a name that is not obvious (not admin, not your company name). On a default install, members of Administrators can sign in over Remote Desktop, but local policies can change that, so log out, log in as the new user, and check that it works before you change anything about the built-in account.

By default the new account's password expires under the local password policy (42 days on a default standalone server). Many people set it to never expire for a single-admin box and rely on the long passphrase instead; if you want that, add -PasswordNeverExpires, knowingly.

What to do with the built-in Administrator then:

  • If your host's panel resets passwords or runs scripts as Administrator, keep it enabled with its long new password.
  • Otherwise you can disable it once your own account works: Disable-LocalUser -Name "Administrator".

3. Turn on an account lockout policy

A lockout policy turns millions of guesses into a handful:

net accounts /lockoutthreshold:10 /lockoutwindow:15 /lockoutduration:15 net accounts 

That locks an account for 15 minutes after 10 wrong passwords; the count of wrong passwords resets 15 minutes after the last failed try. Do not go much stricter: a bot can lock you out too, which is one more reason the firewall step below is the real fix.

The built-in Administrator account has its own switch. For years it was never locked out; newer, updated Windows versions can lock it too, controlled by the policy Allow Administrator account lockout (Local Security Policy > Account Policies > Account Lockout Policy). net accounts does not show or change that setting, so check it there. Either way, logging in with your own account from step 2 avoids the question.

4. Check that Network Level Authentication is on

With NLA, Windows checks your credentials before it starts a full desktop session, so unauthenticated bots never get a login screen to play with. It is on by default on current Windows Server; confirm it:

(Get-CimInstance -Namespace root/cimv2/TerminalServices -ClassName Win32_TSGeneralSetting -Filter "TerminalName='RDP-Tcp'").UserAuthenticationRequired 

1 means NLA is required. If you see 0, turn it on in System Properties > Remote > "Allow connections only from computers running Remote Desktop with Network Level Authentication".

5. Only let your own IP address reach RDP

This is the step that makes the noise stop. If you connect from a fixed IP (home, office or a VPN you control), scope the built-in Remote Desktop firewall rules to it:

# your public IP, as seen from the internet (Invoke-RestMethod https://api.ipify.org) Set-NetFirewallRule -DisplayGroup "Remote Desktop" -RemoteAddress 203.0.113.10 Get-NetFirewallRule -DisplayGroup "Remote Desktop" | Get-NetFirewallAddressFilter 

Run the first line on your own computer (or open the URL in a browser), not on the server, and put that address in place of 203.0.113.10. You can list several: -RemoteAddress 203.0.113.10,198.51.100.0/24.

What this changes: every rule in the built-in "Remote Desktop" group, that is the TCP and UDP rules for port 3389 and the "Shadow" rule used for session shadowing. All of them now accept only your address.

It only helps if the firewall is on, blocks by default, and nothing else lets 3389 in. First check every profile:

Get-NetFirewallProfile -PolicyStore ActiveStore | Select-Object Name, Enabled, DefaultInboundAction 

Enabled should be True and DefaultInboundAction should be Block. If a profile shows Allow, everything not explicitly blocked gets in, and scoping the RDP rules changes nothing; fix that first.

Then list the enabled inbound "allow" rules that are actually in effect (ActiveStore, which includes policy-applied rules) and could cover RDP: rules for port 3389, for Any port, or for a port range:

Get-NetFirewallRule -PolicyStore ActiveStore -Direction Inbound -Action Allow -Enabled True | ForEach-Object { $pf = $_ | Get-NetFirewallPortFilter [pscustomobject]@{ Rule = $_.DisplayName Protocol = $pf.Protocol Port = ($pf.LocalPort -join ',') From = (($_ | Get-NetFirewallAddressFilter).RemoteAddress -join ',') } } | Where-Object { $_.Port -match '^Any$|3389|-' } | Sort-Object Rule | Format-Table -AutoSize 

Read through what it prints. Besides the Remote Desktop rules (now limited to your IP), anything with Any in Port and Any in From deserves a closer look, especially if Protocol is TCP or Any. Many built-in rules are limited to a program or service instead of a port, so not every Any line opens RDP, but the ones you did not create yourself are worth understanding.

Then test it: keep your current session open, connect once from your allowed address (should work) and once from a different network, such as an iPhone on mobile data with the Windows App, or a laptop on a phone hotspot (should fail). That proves the rule works for those two networks; together with the rule review above, it gives you good confidence the rest of the internet is shut out too.

Two warnings:

  • If your home IP changes, you are locked out. Open the host's console, look up your new IP, and scope the same rules to it: Set-NetFirewallRule -DisplayGroup "Remote Desktop" -RemoteAddress <your new IP>. Do not "fix" it by setting -RemoteAddress Any; that opens the whole group to the internet again.
  • -DisplayGroup "Remote Desktop" is the English name. On any language you can use the group's internal name instead: Set-NetFirewallRule -Group "@FirewallAPI.dll,-28752" -RemoteAddress 203.0.113.10.

If your IP changes all the time, the better answer is a VPN (for example WireGuard) to the server, and RDP only over the VPN.

What about changing the RDP port? Moving 3389 to another port cuts the log noise, but it is not protection: scanners find RDP on any port. Do it if you like quieter logs, never instead of steps 1-5.

6. Keep Windows updated

Most real RDP compromises come from weak passwords or old, unpatched systems, not from clever attacks. Open the server configuration tool:

sconfig 

In Windows Server 2022/2025:

  • Option 5 (Update setting): set it to Automatic so updates install on their own.
  • Option 6 (Install updates): install everything that is waiting now.

On a server with the desktop experience, Settings > Windows Update works too. Plan a reboot window, because many updates need one.

7. See who is knocking

Failed logons are event 4625 in the Security log. This shows the last 20 with the account name, source IP and logon type:

Get-WinEvent -FilterHashtable @{ LogName = 'Security'; Id = 4625 } -MaxEvents 20 | Select-Object TimeCreated, @{ n = 'User'; e = { $_.Properties[5].Value } }, @{ n = 'FromIP'; e = { $_.Properties[19].Value } }, @{ n = 'LogonType'; e = { $_.Properties[10].Value } } 

Event 4625 covers every failed logon, not only RDP. Bot guesses against RDP with NLA usually show as logon type 3 (network) from outside IP addresses; type 10 is a failed full Remote Desktop sign-in.

Run it before step 5 and again a day later. Far fewer outside IPs afterwards is a good sign, but it is not proof on its own. What you rely on is the firewall setup from step 5: the profile check, the rule review and the two test connections together.

Connecting from a Mac or phone

On Windows, use Remote Desktop Connection (mstsc). On a Mac, iPhone, iPad or Android, install Microsoft's Windows App (the new name of the Remote Desktop app); Microsoft keeps a compatibility list per platform if a feature seems missing. Remember that if you scoped RDP to your home IP in step 5, your phone on mobile data has a different IP and will not get in, which is exactly the point.

A note on licensing

Windows Server allows two simultaneous Remote Desktop sessions for administration. If you want more people using the server at the same time, or anyone using it for work other than administration, you need Remote Desktop Services licensing as well. Check this before you build something many users depend on.

Checklist

  • [ ] Changed the first password to a long passphrase
  • [ ] Created your own admin account and tested it
  • [ ] Lockout policy set (10 / 15 / 15), Administrator lockout setting checked
  • [ ] NLA confirmed (UserAuthenticationRequired = 1)
  • [ ] Firewall on with default inbound Block; RDP firewall rules scoped to your IP (or RDP only over a VPN), no other rule opening 3389, tested from a second network
  • [ ] Updates set to Automatic and installed
  • [ ] Looked at event 4625 before and after

That is it. None of it is exotic, and together it moves your server from "one of millions of easy targets" to "not worth a bot's time".

I work on HostingBaba, a Linux and Windows VPS host. Our Windows plans come with the server's own console in the browser for exactly the "I locked myself out" moment in step 5; more about them at hostingbaba.net/rdp-vps. The steps above work on any Windows Server VPS, wherever it runs.