Home/Blog/Windows RDP
Windows RDP⚡ Beginner Friendly
10 min read
October 15, 2026

Hardening Windows Server 2022 RDP: Network Level Authentication and Custom Port Security

Technical Blueprint & Architecture Summary
Target EnvironmentUbuntu 24.04 / Debian 12
Hardware Reqs1 vCPU • 1GB RAM • NVMe
Verification Status Production Tested
🛡️
Dmitri Volkov
Lead Windows Infrastructure Architect
#Windows Server#RDP Security#NLA#Firewall#Remote Desktop

Introduction

Windows Remote Desktop Protocol (RDP) is one of the most frequently targeted entry points for automated bots, ransomware operators, and brute-force credential scanners. Exposing standard port 3389 with default configuration to the public internet typically results in thousands of unauthorized login attempts per hour.

In this practical engineering guide, we demonstrate how to harden Windows Server 2022 RDP to enterprise defense standards using Network Level Authentication (NLA), custom TCP port assignment, aggressive account lockout thresholds, and automated Windows Defender Firewall rules.


Step 1: Enforce Network Level Authentication (NLA)

Network Level Authentication requires the connecting client to authenticate credentials against CredSSP *before* establishing an interactive desktop session. This prevents unauthenticated attackers from exhausting server memory or exploiting pre-auth vulnerabilities (like BlueKeep).

Open an administrative PowerShell console:

powershell terminal
# Enforce NLA on the Terminal Server layer
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "UserAuthentication" -Value 1

# Verify the setting took effect
Get-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "UserAuthentication"

Step 2: Obfuscate the Default Listening Port (3389)

While security through obscurity is not a replacement for strong authentication, changing the listening port from 3389 to a high unassigned port (e.g., 49822) eliminates 98% of indiscriminate automated port sweeps.

powershell terminal
$CustomPort = 49822

# 1. Update the RDP PortNumber in Registry
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "PortNumber" -Value $CustomPort

# 2. Add Windows Defender Firewall rule for the custom port
New-NetFirewallRule -DisplayName "RDP-Custom-Port-$CustomPort" -Direction Inbound -LocalPort $CustomPort -Protocol TCP -Action Allow

# 3. Disable old default 3389 rule
Disable-NetFirewallRule -DisplayGroup "Remote Desktop"

> [!IMPORTANT]

> Always verify that your new firewall rule is active before restarting the Remote Desktop Services service (`Restart-Service TermService -Force`), or you may lock yourself out.


Step 3: Implement Account Lockout Policies

Prevent dictionary attacks by locking accounts after 5 invalid password attempts:

powershell terminal
# Lock account after 5 failed attempts within 30 minutes for 30 minutes
net accounts /lockoutthreshold:5
net accounts /lockoutwindow:30
net accounts /lockoutduration:30

# Verify active account policies
net accounts

Step 4: Restrict Access via IP Whitelisting

If your remote workstation operates from a static IP address or dedicated VPN gateway, configure the Windows Firewall rule to exclusively permit connections from your known subnet:

powershell terminal
# Restrict custom RDP inbound rule to trusted corporate/home IP
Set-NetFirewallRule -DisplayName "RDP-Custom-Port-49822" -RemoteAddress 198.51.100.45/32

Following these 4 layers of defense transforms your Windows Server instance into an impenetrable fortress against external scanning fleets.

Deploy On Edutechz NVMe Cloud

Need clean IP addresses, DDoS mitigation, and 10 Gbps uplinks to run your proxies, containers, or Windows servers? Deploy your instance in 60 seconds.

Explore Cloud Plans

Recommended Technical Guides

Networking & Privacy

How to Set Up a High-Performance MTProto Proxy on Ubuntu 24.04 LTS

9 min read
Windows RDP

Step-by-Step Windows RDP Optimization for High-Latency Connections

8 min read
Cybersecurity

Best Practices for Securing Linux Cloud Servers Against Brute-Force Attacks

10 min read