Learn › Windows Server

Hardening Windows Server: A Practical Security Baseline

Windows Server hardening checklist: accounts, patching, SMB, RDP, firewall, logging and security baselines, with PowerShell checks you can script.

Advanced 12 min read
By Gopinath Karthikeyan

Most successful attacks on Windows servers don’t use clever new techniques. They use old ones: unpatched systems, reused admin passwords, open RDP, and legacy protocols. A good baseline closes those doors. This guide lists the high-value settings and how to check them.

Always agree hardening changes with your security team and test them on non-production first. Some legacy apps depend on old protocols.

1. Accounts and admin rights

  • Separate admin accounts – do daily work (email, browsing) with a normal account; use an admin account only for admin tasks.
  • Unique local administrator passwords – use Windows LAPS (built into Windows Server 2019+ with recent updates) so every server’s local admin password is different and rotated automatically.
  • Least privilege – remove people from local Administrators who don’t need it.
Get-LocalGroupMember -Group Administrators

2. Patch, and remove what you don’t use

  • Monthly patching (see Patching Windows Server safely).
  • Uninstall roles, features and software that aren’t needed. Every component is attack surface.

3. Turn off legacy protocols

SMBv1 is old and was used by large ransomware outbreaks. It should be off everywhere:

Get-WindowsOptionalFeature -Online -FeatureName SMB1Protocol | Select-Object State
Get-SmbServerConfiguration | Select-Object EnableSMB1Protocol, RequireSecuritySignature
# Disable if still enabled (test first!)
Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force

Also review: NTLMv1 and LM authentication (should be refused), old TLS 1.0/1.1 (disable where apps allow), and SMB signing (newer Windows versions require it by default – check yours).

4. Remote Desktop

  • Never expose RDP (port 3389) directly to the internet.
  • Require Network Level Authentication:
(Get-CimInstance -Namespace root\cimv2\TerminalServices -ClassName Win32_TSGeneralSetting).UserAuthenticationRequired

1 means NLA is on.

  • Allow RDP only from admin networks or a jump host, using the Windows Firewall or network firewalls.
  • Log off idle and disconnected sessions automatically with Group Policy.

5. Windows Firewall

Keep it on for all profiles, and allow only what the server needs:

Get-NetFirewallProfile | Select-Object Name, Enabled, DefaultInboundAction
Get-NetFirewallRule -Enabled True -Direction Inbound | Select-Object -First 20 DisplayName, Profile

6. Logging you’ll need during an incident

  • Increase the Security log size (the default fills quickly) and forward logs to a central system (see the Monitoring track).
  • Enable advanced audit policy for logons, account management, and privilege use.
  • Enable PowerShell Script Block Logging – it records the PowerShell that ran, which is invaluable when investigating.
auditpol /get /category:"Logon/Logoff"

7. Use Microsoft’s baseline instead of inventing your own

Microsoft publishes Security Baselines for each Windows Server version as part of the free Security Compliance Toolkit. They contain GPO backups and a comparison tool (Policy Analyzer). Start from the baseline, test it, and document the few exceptions your apps need. That’s far faster and safer than choosing hundreds of settings yourself.

8. Check, don’t assume

Put the checks above into a script that writes one line per server, and run it monthly:

[pscustomobject]@{
    Server        = $env:COMPUTERNAME
    SMB1          = (Get-SmbServerConfiguration).EnableSMB1Protocol
    FirewallOn    = -not (Get-NetFirewallProfile | Where-Object { -not $_.Enabled })
    NLA           = (Get-CimInstance -Namespace root\cimv2\TerminalServices -ClassName Win32_TSGeneralSetting).UserAuthenticationRequired -eq 1
    LastPatch     = (Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 1).InstalledOn
    LocalAdmins   = (Get-LocalGroupMember Administrators).Count
}

Run it across many servers with PowerShell remoting or Ansible, and you have a compliance report.

FAQ

Will hardening break my applications? It can, which is why you test on non-production, roll out in stages, and keep a list of documented exceptions.

Is antivirus enough? No. Antivirus helps, but most of the protection comes from patching, limiting admin rights and turning off legacy protocols.

What’s next

You’ve finished the Windows Server track’s core. Move on to PowerShell to automate everything you’ve learned.

Practise this topic

Test yourself with free questions on this topic – instant answers and explanations.

Start practice questions

SecurityHardeningWindows ServerPowerShellBest Practices

Gopinath Karthikeyan

Gopinath Karthikeyan – Windows Site Reliability Engineer with about 12 years in enterprise Windows Server infrastructure, and founder of WinOps Academy. YouTube · LinkedIn

More in Windows Server