Cloud VPS from $1.98/mo · pay with Bitcoin, Ethereum, Monero, USDT or Solana · paid in crypto
Security

Harden a Windows Server VPS: RDP, accounts and updates

Harden a Windows Server 2022 or 2025 VPS: restrict RDP, require NLA, separate admin accounts, set a lockout policy, patch, trim services, watch logon events.

CloudSat teamNovember 18, 20266 min read
Abstract illustration of a window-shaped server panel layered with translucent shields, one narrow opening glowing for a single address
On this page1. Shrink the RDP exposure

A Windows server in the cloud is reachable over Remote Desktop from the minute it boots, and scanners find port 3389 within hours. Hardening it is mostly a matter of order: shrink what is exposed, make the accounts behind it hard to abuse, keep it patched, remove what it does not need, and watch who logs in. Every command below runs in PowerShell as administrator on Windows Server 2022 or 2025, and most work on 2019.

Keep your current RDP session open while you change firewall or Remote Desktop settings, test with a second connection, and take a snapshot first so a bad change costs minutes instead of a rebuild.

1. Shrink the RDP exposure

The single most effective step is letting only your own addresses reach port 3389. Do it in the provider's firewall, where blocked traffic never reaches Windows at all. CloudSat's Windows firewall preset allows 3389 from anywhere, so put your office or home address in the rule's Sources field (Create and apply cloud firewalls).

Then scope the Windows Firewall rules to the same address, so the server stays protected if the outer firewall is ever detached:

Get-NetFirewallRule -DisplayGroup "Remote Desktop" | Get-NetFirewallAddressFilter
Get-NetFirewallRule -DisplayGroup "Remote Desktop" | Set-NetFirewallRule -RemoteAddress 198.51.100.24

If your address changes often, put RDP behind a VPN and allow 3389 only from the tunnel range. Moving RDP to another port cuts log noise but stops nothing that scans every port; scoping is what counts. For rule management at scale, see manage Windows Firewall with Group Policy and PowerShell.

2. Require Network Level Authentication

NLA makes the client authenticate before Windows builds a session, so unauthenticated visitors never reach the logon screen. It is on by default in current releases; 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:

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

3. Separate the accounts

Every scanner tries Administrator first. Create a named administrator for daily work and use it for RDP:

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

Give the built-in Administrator a long random password stored in a password manager. Microsoft's documentation notes that the built-in Administrator is exempt from the account lockout policy by default, which makes its password the most exposed secret on the machine.

Many guides tell you to rename or disable it. Check your provider's recovery path first: CloudSat's console password reset sets a new password for Administrator, so renaming or disabling that account removes a rescue route you may need one day.

Also check who else may log on remotely. Administrators can by default, and so can members of Remote Desktop Users, which should be empty unless you added someone on purpose:

Get-LocalGroupMember -Group "Administrators"
Get-LocalGroupMember -Group "Remote Desktop Users"

4. Set an account lockout policy

A standalone server ships with no lockout threshold, so an account can be guessed at forever. Microsoft's security baselines suggest 10 failed attempts as a starting point:

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

That locks an account for 15 minutes after 10 failures within 15 minutes. The trade-off is that anyone who can reach the logon prompt can lock a known account on purpose, which is one more reason step 1 comes first. Two-factor options for RDP are covered in two-factor authentication for Windows sign-in and RDP.

5. Patch on a schedule

Run sconfig and choose the Windows Update option to set automatic downloads and installs, or manage updates through Group Policy if you run several servers. Then check that updates actually land:

Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 5

Monthly cumulative updates usually need a restart. Pick a fixed maintenance window, and make sure the services you host start again on their own afterwards.

6. Remove what you do not use

Every role and service is code that can have a flaw. List what is installed and remove what the server does not need:

Get-WindowsFeature | Where-Object Installed | Select-Object Name, DisplayName
Get-WindowsFeature FS-SMB1

SMB1 is not installed by default on current releases; if it shows as installed, remove it with Uninstall-WindowsFeature FS-SMB1 and restart. A server that never prints does not need the Print Spooler:

Stop-Service Spooler
Set-Service Spooler -StartupType Disabled

Then look at what listens on the network. File sharing (445), remote management (5985 and 5986) and database ports should never be open to the whole internet:

Get-NetTCPConnection -State Listen | Sort-Object LocalPort | Select-Object LocalAddress, LocalPort, OwningProcess -Unique

7. Keep Microsoft Defender on

Defender Antivirus is built into Windows Server and is enough for most single servers, as long as it stays enabled and current:

Get-MpComputerStatus | Select-Object AMServiceEnabled, RealTimeProtectionEnabled, AntivirusSignatureLastUpdated
Update-MpSignature
Start-MpScan -ScanType QuickScan

Unlike desktop Windows, Windows Server does not switch Defender off by itself when you install another antivirus product. Follow that vendor's instructions to put Defender in passive mode or remove it, and never run two real-time scanners side by side.

8. Watch the logons

Failed logons are event 4625 in the Security log. This lists the last twenty with the account name and source address:

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

With NLA, failed RDP attempts show logon type 3 (network), because the password is checked before a session exists. Successful Remote Desktop sessions are event 4624 with logon type 10. Event 1149 in the Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational log records each successful RDP authentication with its source address, which makes a quick daily check.

Event ID Meaning Worry when
4625 Failed logon Thousands from one address: step 1 is not done
4624, type 10 Remote Desktop logon The source address is not yours
4720 User account created You did not create it
4732 Member added to a local group Someone joined Administrators

The Security log overwrites its oldest events when it fills up, and on a server under constant guessing that can mean only a few days of history. Give it room, and record the PowerShell commands that run on the machine, which is where most hands-on intrusions show up:

wevtutil sl Security /ms:268435456
$key = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging'
New-Item -Path $key -Force | Out-Null
Set-ItemProperty -Path $key -Name EnableScriptBlockLogging -Value 1

The first line sets the Security log to 256 MB. Script blocks then appear as event 4104 in the Microsoft-Windows-PowerShell/Operational log.

9. Plan the way back

Hardening changes can lock you out as easily as they lock out attackers. Snapshot before each batch of changes, keep the provider's web console in mind for when RDP fails, and test a restore once so you know how long it takes.

FAQ

Should I change the RDP port?

It reduces automated noise in the logs, which can make real attempts easier to spot. It is not protection: a full port scan finds the new port. Restrict the source addresses instead.

Is Microsoft Defender enough on a server?

For a single server with restricted RDP, prompt updates and no untrusted software, generally yes. Larger fleets benefit from central management and alerting on top.

Do I need Active Directory for one server?

No. Local accounts are fine for a single server. A domain starts to pay off when several servers need the same users and policies.

How do I know whether someone got in?

Look for 4624 type 10 logons from unknown addresses, new accounts (4720), new members of Administrators (4732), and scheduled tasks or services you did not create. If you find any, treat the server as compromised and rebuild it from a clean image and known-good backups.

Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.