Skip to content
HOSTIGAN
Windows Server

How to protect Windows Server against unauthorised access

Harden Windows Server against RDP brute force: restrict access, enforce NLA and lockout, retire the built-in Administrator, add MFA and watch event 4625.

Intermediate 5 min read Updated November 24, 2026

Put a Windows server on the internet with Remote Desktop open on port 3389, and automated scanners will start trying passwords within hours. They are not targeting you personally; they try every address they can find, all day, with lists of common usernames and leaked passwords. You can't stop them from knocking, but you can make sure the door doesn't open. This guide walks through the layers that matter, in order of impact, with the PowerShell to put each one in place.

You need an administrator RDP session and, ideally, the VPS console open in a browser as a fallback.

Think in layers

No single setting makes a server secure. Combine several independent layers so that one mistake doesn't leave you exposed:

LayerWhat it doesMain tools
NetworkDecides who can reach RDP at allFirewall scope, VPN, RD Gateway
AuthenticationMakes each login attempt hard to winNLA, long passwords, lockout, MFA
AccountsRemoves easy targets and gives accountabilityPersonal admins, disabled built-in Administrator
SystemCloses known holesWindows Update, Microsoft Defender
MonitoringTells you when something is wrongSecurity log, event 4625

Warning: Several steps below can lock you out if done carelessly. Keep the console available and always test with a new RDP window before closing the one you're working in.

1. Restrict who can reach RDP

The most effective single step. A connection dropped by the firewall never sees a login prompt, so it can't guess anything. Limit the built-in Remote Desktop rules to your own public IP addresses:

$rdp = Get-NetFirewallRule -DisplayGroup "Remote Desktop" | Where-Object Direction -eq "Inbound"
$rdp | Set-NetFirewallRule -RemoteAddress 203.0.113.10, 198.51.100.0/24
$rdp | Get-NetFirewallAddressFilter | Format-Table RemoteAddress

-RemoteAddress replaces the existing list, so always include every address you need. The details, including logging and recovery, are in configuring Windows Firewall.

If your team works from changing locations, put RDP behind something instead of opening it to the world:

  • A VPN (WireGuard, OpenVPN or similar) — allow RDP only from the VPN subnet.
  • Remote Desktop Gateway — a Windows role that wraps RDP in HTTPS on port 443 and gives you a single, controlled entry point.

2. Require Network Level Authentication

With NLA, the client has to authenticate before Windows creates a full desktop session. Bad attempts are rejected earlier and with less effort for the server, and some older RDP vulnerabilities can't be reached without valid credentials. It is on by default in current versions, but check:

(Get-CimInstance -Namespace root\cimv2\terminalservices -ClassName Win32_TSGeneralSetting -Filter "TerminalName='RDP-tcp'").UserAuthenticationRequired

1 means NLA is required. If you get 0, enable it:

Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name UserAuthentication -Value 1

The same setting is under Settings → System → Remote Desktop → Advanced settings.

3. Long passwords and an account lockout policy

Brute force only works against guessable passwords. Use passphrases of 16 characters or more, generated and stored in a password manager, and never reuse one from another system. Then add a lockout policy, so each account only gets a handful of guesses before it is paused:

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

That locks an account for 15 minutes after 10 failures within 15 minutes. The same settings are in secpol.msc under Account Policies → Account Lockout Policy.

Note: Lockout cuts both ways — an attacker can deliberately lock out your real users by failing on purpose. That is another reason to restrict RDP at the network level first; lockout is the backstop, not the front line.

4. Use personal admin accounts and retire Administrator

Every attacker tries Administrator first. Renaming it hides the name, but the account keeps its well-known security identifier (ending in -500), so it is obscurity rather than protection. The better approach is to give each administrator a personal account and then disable the built-in one:

$pw = Read-Host -AsSecureString "Password for lena.admin"
New-LocalUser -Name "lena.admin" -Password $pw -FullName "Lena Holm"
Add-LocalGroupMember -Group "Administrators" -Member "lena.admin"

Log in as the new account in a separate RDP window. Before you disable the built-in account, make sure no services or scheduled tasks run as it:

Get-CimInstance Win32_Service | Where-Object StartName -like "*Administrator*" | Select-Object Name, StartName
Get-ScheduledTask | Where-Object { $_.Principal.UserId -like "*Administrator*" } | Select-Object TaskName
Disable-LocalUser -Name "Administrator"

Personal accounts also mean the event log shows who did what. More on this in users and administrators in Windows Server.

5. Add multi-factor authentication

With MFA, a stolen or guessed password alone is not enough. Windows Server has no built-in MFA for plain RDP logins to a standalone server, so it comes from one of these:

  • RD Gateway with Microsoft Entra MFA through the Network Policy Server (NPS) extension.
  • MFA on the VPN, so nobody reaches RDP without passing a second factor first.
  • A third-party Windows logon MFA agent from a reputable vendor. Test what happens when its service is unreachable, so an outage doesn't lock you out of your own server.

6. Keep Windows and Defender up to date

Many of the worst RDP flaws over the years were fixed by patches long before most attacks used them. Check when updates were last installed, and make updating part of a monthly routine with a planned restart:

Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 5
Get-MpComputerStatus | Select-Object RealTimeProtectionEnabled, AntivirusSignatureLastUpdated
Update-MpSignature

sconfig gives you a simple menu for installing updates on both Desktop Experience and Server Core.

Should you change the RDP port?

Moving RDP from 3389 to another port cuts down log noise from the dumbest bots, but a full port scan finds it in minutes. It is a minor extra, never a substitute for the layers above. If you do it, follow a safe order:

New-NetFirewallRule -DisplayName "RDP 3390 TCP" -Direction Inbound -Protocol TCP -LocalPort 3390 -RemoteAddress 203.0.113.10 -Action Allow -Profile Any
$rdpKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp'
Set-ItemProperty -Path $rdpKey -Name PortNumber -Value 3390
Restart-Service TermService -Force

Open the new port first, then change it — restarting the service disconnects every session. Reconnect with mstsc /v:YOUR_SERVER_IP:3390, and only then disable the old 3389 rules. Choose a free port above 1024 and below 49152. If it goes wrong, use the console to set PortNumber back to 3389 and restart TermService.

Watch failed logins

Windows records every failed logon in the Security log as event 4625 (4624 is a success, 4740 a lockout). This shows the ten addresses with the most failures among the last 500 events:

Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4625} -MaxEvents 500 |
    ForEach-Object { $_.Properties[19].Value } |
    Group-Object | Sort-Object Count -Descending | Select-Object -First 10 Count, Name

Hundreds of failures from many different addresses means RDP is too exposed. Don't play whack-a-mole blocking IPs one by one — fix the scope or move RDP behind a VPN. Make sure logon auditing is on with auditpol /get /category:"Logon/Logoff".

In short

In order of impact: restrict RDP to known addresses or a VPN; require NLA, long passwords and a lockout policy, ideally plus MFA; use personal admin accounts and disable the built-in Administrator; keep Windows and Defender patched; and check event 4625 regularly. Changing the port is optional garnish. Remember that DDoS protection solves a different problem — see what a DDoS attack is — and run through the general VPS security checklist too.

Security on Hostigan servers

Every Hostigan VPS and dedicated server sits behind always-on upstream DDoS filtering, included on every plan, which keeps traffic floods away from your server. Login security is in your hands: on a VPS you have full administrator access, so the firewall, accounts and policies described here are yours to set. On VPS Plus and up, take a snapshot before major security changes.

Frequently asked questions

No. A different port cuts down the noise from simple bots, but anyone running a full port scan finds the service anyway. Restricting who can connect, strong passwords and NLA are what actually protect you.