Windows Server hardening: baselines, protocols and auditing
-
Phase 0: Before you start
-
Phase 1: The foundation
-
Phase 2: Core administration and security
-
Phase 3: Enterprise infrastructure
-
Phase 4: Troubleshooting step by step
-
Phase 5: Final project and career
A freshly installed server is reasonably safe, but “reasonably” isn’t good enough once it holds payroll data. Windows Server hardening means turning off what you don’t need, requiring stronger protocols, and recording enough to know when something goes wrong.
In this lesson you’ll check Defender and the firewall, apply a hardening GPO to your DCs (including the spooler from Lesson 18), require SMB signing on SRV01, turn off old TLS versions, set up audit policy, and see how Server 2025’s OSConfig baseline works. Then you’ll lock yourself out with one rule too many.
| Time | You need | By the end you can |
|---|---|---|
| About 90 minutes | DC01, SRV01 and CL01 from Lesson 22 | Check Defender and firewall status, harden with GPOs, require SMB signing, disable TLS 1.0 and 1.1, configure advanced auditing and apply a security baseline safely |
What it is, in one line
Windows Server hardening is reducing a server’s attack surface and strengthening its settings so attackers have fewer ways in and you have a clear record of what they tried.
In Simple Words
Locking up a shop at night
A shop owner doesn’t just lock the front door. She closes the windows nobody uses, puts the cash in a safe, switches on the alarm and leaves the camera recording.
Hardening a server is the same routine. Turn off services you don’t need (close windows), require strong protocols (better locks), encrypt disks (the safe), and switch on auditing (the camera).
And just like a shop with too many locks, a server can become so locked down that the staff can’t get in. Good hardening is tested before it goes live.
Engineer's View
Baselines, protocols, encryption and audit
Security baselines are Microsoft’s recommended settings for each Windows version, published in the Security Compliance Toolkit as GPOs. On Windows Server 2025, OSConfig can apply the baseline locally with PowerShell and corrects drift by itself.
Protocols: require SMB signing to stop relay and tampering (Server 2025 requires it for outbound connections by default, DCs require it inbound), keep SMB1 removed, disable TLS 1.0 and 1.1, and reduce NTLM. Defender Antivirus is built into Server 2025; keep it on and updated, with exclusions only where vendors require them.
Firewall: keep all three profiles on with inbound blocked by default, and open only what each role needs. BitLocker protects data on stolen disks and VMs; store recovery keys in AD. In this lab, SRV01 uses BIOS firmware without a virtual TPM, so you’ll plan BitLocker rather than turn it on.
Auditing: use Advanced Audit Policy (not the legacy categories) for logon, account management, Kerberos, directory service changes and policy changes, and forward events to a central place. Without logs, you can’t investigate.
How it works, step by step
Hardening works in layers. Each one assumes the layer outside it might fail:
Apply hardening to groups of servers with GPOs, so a new server gets the same protection the moment it joins the right OU. Test every change on one server first, with a snapshot.
These are the hardening pieces you’ll put in place:
- Check Defender, firewall profiles and SMB signing as they are.
- C-DC-Hardening GPO on Domain Controllers: spooler disabled, advanced auditing.
- SMB signing required on SRV01, and TLS 1.0/1.1 turned off.
- Test auditing with a failed sign-in.
- OSConfig baseline on SRV01, after a snapshot.
Hands-on Lab: Windows Server hardening on SRV01 and the DCs
Start DC01, SRV01 and CL01. Take a snapshot of each first: 'DC01','SRV01','CL01' | ForEach-Object { VBoxManage snapshot $_ take 'Before hardening' } on your laptop. Work in PowerShell as administrator.
1Check Defender and the firewall
On SRV01, run this:
Get-MpComputerStatus | Select-Object AMServiceEnabled, RealTimeProtectionEnabled, AntivirusSignatureLastUpdated
Update-MpSignature
Get-NetFirewallProfile | Select-Object Name, Enabled, DefaultInboundAction, LogBlockedYou should see something like this:
AMServiceEnabled RealTimeProtectionEnabled AntivirusSignatureLastUpdated
---------------- ------------------------- -----------------------------
True True 19/10/2026 06:12:40
Name Enabled DefaultInboundAction LogBlocked
---- ------- -------------------- ----------
Domain True NotConfigured NotConfigured
Private True NotConfigured NotConfigured
Public True NotConfigured NotConfigured“NotConfigured” for inbound means the built-in default, which is Block. Turn on logging of dropped packets so you can see what the firewall stops:
On SRV01:
Set-NetFirewallProfile -All -LogBlocked True -LogMaxSizeKilobytes 16384
Get-NetFirewallProfile -Name Domain | Select-Object LogBlocked, LogFileNameYou should see something like this:
LogBlocked LogFileName
---------- -----------
True %systemroot%\system32\LogFiles\Firewall\pfirewall.log✅ Checkpoint: Defender is on with fresh signatures, all firewall profiles are on, and blocked packets are logged.
2Check and require SMB signing on SRV01
On SRV01:
Get-SmbClientConfiguration | Select-Object RequireSecuritySignature
Get-SmbServerConfiguration | Select-Object RequireSecuritySignature, EnableSMB1Protocol
Set-SmbServerConfiguration -RequireSecuritySignature $true -Force
Get-SmbServerConfiguration | Select-Object RequireSecuritySignatureYou should see something like this:
RequireSecuritySignature
------------------------
True
RequireSecuritySignature EnableSMB1Protocol
------------------------ ------------------
False False
RequireSecuritySignature
------------------------
TrueServer 2025 already requires signing when SRV01 connects out, and SMB1 is off. Inbound, the file server didn’t require it until now. In production, set this with the GPO setting “Microsoft network server: Digitally sign communications (always)” so every file server gets it.
✅ Checkpoint: SRV01 now requires SMB signing inbound, and SMB1 is disabled. Priya can still open S: from CL01.
3Turn off TLS 1.0 and 1.1 on SRV01
On SRV01, set the SCHANNEL keys for both old versions, server and client side:
foreach ($v in 'TLS 1.0','TLS 1.1') {
foreach ($side in 'Server','Client') {
$k = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\$v\$side"
New-Item $k -Force | Out-Null
New-ItemProperty $k -Name Enabled -Value 0 -PropertyType DWord -Force | Out-Null
New-ItemProperty $k -Name DisabledByDefault -Value 1 -PropertyType DWord -Force | Out-Null
}
}
Get-ChildItem 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols' -Recurse |
Get-ItemProperty | Select-Object @{n='Key';e={$_.PSPath -replace '.*Protocols\\'}}, Enabled, DisabledByDefaultYou should see something like this:
Key Enabled DisabledByDefault
--- ------- -----------------
TLS 1.0\Client 0 1
TLS 1.0\Server 0 1
TLS 1.1\Client 0 1
TLS 1.1\Server 0 1Restart SRV01 for SCHANNEL changes to take effect. Recent Windows versions already avoid these old versions, but setting them explicitly makes the intent clear and survives any app that tries to turn them back on. IIS on SRV01 (Lesson 25) will then only speak TLS 1.2 and 1.3.
✅ Checkpoint: All four keys show Enabled 0 and DisabledByDefault 1, and SRV01 has restarted.
4Harden the DCs with a GPO: spooler and auditing
On DC01, create a GPO called C-DC-Hardening and link it to the Domain Controllers OU. Edit it: Computer Configuration, Policies, Windows Settings, Security Settings, System Services, Print Spooler, tick Define this policy setting and choose Disabled.
Then go to Security Settings, Advanced Audit Policy Configuration, Audit Policies and set Success and Failure for: Account Logon, Audit Kerberos Authentication Service; Account Management, Audit User Account Management and Audit Security Group Management; Logon/Logoff, Audit Logon; DS Access, Audit Directory Service Changes (Success).
On DC01, apply and check:
gpupdate /force
auditpol /get /subcategory:"Kerberos Authentication Service","Security Group Management","Logon"
Get-Service Spooler | Select-Object Status, StartTypeYou should see something like this:
System audit policy
Category/Subcategory Setting
Account Logon
Kerberos Authentication Service Success and Failure
Account Management
Security Group Management Success and Failure
Logon/Logoff
Logon Success and Failure
Status StartType
------ ---------
Stopped DisabledThe spooler setting you applied by hand in Lesson 18 is now enforced by policy, so a new DC gets it automatically. The audit settings make DCs record failed Kerberos sign-ins (4771), group changes (4728, 4732) and more.
✅ Checkpoint: auditpol shows Success and Failure for the three subcategories, and the spooler is Stopped and Disabled.
5Test auditing with a failed sign-in
On CL01, sign out and try to sign in as SAATLAB\priya.sharma with a wrong password, once. Then sign in correctly.
On DC01, look for the failure:
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4771} -MaxEvents 5 |
Select-Object TimeCreated, @{n='User';e={$_.Properties[0].Value}}, @{n='Client';e={$_.Properties[6].Value}}, @{n='Code';e={'0x{0:X}' -f $_.Properties[4].Value}}You should see something like this:
TimeCreated User Client Code
----------- ---- ------ ----
19/10/2026 19:41:02 priya.sharma ::ffff:10.0.0.150 0x18Event 4771 is a failed Kerberos pre-authentication; code 0x18 means a bad password. It tells you which account, from which address. Many of these in a short time from one address is a password-guessing attack; the lockout policy from Lesson 19 limits it.
✅ Checkpoint: DC01 logged event 4771 for priya.sharma from 10.0.0.150 with code 0x18.

6Apply the Server 2025 security baseline with OSConfig
On SRV01 (it has internet access through LabNet), install OSConfig and apply the member server baseline:
Install-Module -Name Microsoft.OSConfig -Scope AllUsers -Repository PSGallery -Force
Set-OSConfigDesiredConfiguration -Scenario 'SecurityBaseline/WS2025/MemberServer' -Default
Get-OSConfigDesiredConfiguration -Scenario 'SecurityBaseline/WS2025/MemberServer' |
Select-Object Name, @{n='Status';e={$_.Compliance.Status}} | Select-Object -First 8You should see something like this:
Name Status
---- ------
AuditAccountLockout Compliant
AuditApplicationGroupManagement Compliant
AuditAuthenticationPolicyChange Compliant
AuditAuthorizationPolicyChange Compliant
AuditComputerAccountManagement Compliant
AuditCredentialValidation Compliant
AuditDetailedFileShare Compliant
AuditDistributionGroupManagement CompliantOSConfig applied a few hundred settings and will put them back if anything changes them. Restart SRV01, then check that S:, the printer and the intranet SPN still work from CL01. That check is the real point of the snapshot: baselines are tested, never applied blind.
✅ Checkpoint: OSConfig reports Compliant settings on SRV01, and file and print access still work after a restart.
Break It, Then Fix It
Hardening done badly causes outages. Here are two ways to lock yourself out, and how to get back in.
1Break it: block remote management
On SRV01, disable the WinRM firewall rules:
Disable-NetFirewallRule -DisplayGroup 'Windows Remote Management'On DC01, try to run a command on SRV01:
Invoke-Command -ComputerName SRV01 -ScriptBlock { hostname }You’ll get an error like this:
[SRV01] Connecting to remote server SRV01 failed with the following error message : WinRM cannot complete the
operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and
that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the
WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For
more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (SRV01:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : WinRMOperationTimeout,PSSessionStateBrokenEvery remote tool that uses WinRM now fails: Server Manager, Windows Admin Center, your scripts. If SRV01 were Server Core in a data centre, you’d need console access to fix it. Check what’s blocked with the firewall log you enabled in step 1:
On SRV01:
Select-String -Path C:\Windows\System32\LogFiles\Firewall\pfirewall.log -Pattern ' 5985 ' | Select-Object -Last 2You should see something like this:
2026-10-19 19:52:14 DROP TCP 10.0.0.10 10.0.0.20 50812 5985 52 S 3412871 0 64240 - - - RECEIVE
2026-10-19 19:52:17 DROP TCP 10.0.0.10 10.0.0.20 50812 5985 52 S 3412871 0 64240 - - - RECEIVEFix it: enable the rules again:
Enable-NetFirewallRule -DisplayGroup 'Windows Remote Management'✅ Checkpoint: Invoke-Command failed while the WinRM rules were off, the log showed drops on 5985, and it works again after enabling them.

2Break it: block NTLM without auditing first
On SRV01, deny all incoming NTLM:
Set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0' -Name RestrictReceivingNTLMTraffic -Value 2 -Type DWordOn CL01 as Priya, open the share by name and by IP:
Get-ChildItem \\SRV01.saatlab.internal\Departments | Select-Object -ExpandProperty Name
Get-ChildItem \\10.0.0.20\DepartmentsYou’ll see something like this:
Finance
Get-ChildItem : Access is deniedKerberos still works by name. Anything that relied on NTLM, like IP paths, old scanners and some backup agents, is now refused, and nobody had a list of them. On SRV01, the Microsoft-Windows-NTLM/Operational log records each blocked request.
Fix it: switch to audit mode, collect for a few weeks, fix the sources, then block:
Set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0' -Name RestrictReceivingNTLMTraffic -Value 0 -Type DWord
Set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0' -Name AuditReceivingNTLMTraffic -Value 2 -Type DWord
Get-WinEvent -LogName 'Microsoft-Windows-NTLM/Operational' -MaxEvents 3 | Select-Object TimeCreated, IdIn audit mode, the log lists who still uses NTLM without blocking them. That list becomes your work plan. Block only when it’s empty.
✅ Checkpoint: IP access was denied while NTLM was blocked, and works again in audit mode with NTLM events being logged.
This happened at work
The baseline that stopped the backups
A hospital’s security team applied a full security baseline GPO to every server in one evening, after an audit flagged missing settings. Everything looked fine the next morning.
Three nights later, the backup report showed failures on 60 servers. The backup software’s agents still used NTLM with a service account and an old protocol option, and the baseline’s NTLM and SMB settings blocked both. Nobody noticed for three days because the backup alerts went to a mailbox nobody read.
The team rolled back two settings, ran an emergency backup, and then spent a month working with the vendor on an agent upgrade that supported Kerberos and signing.
The fix: baselines are now applied in rings: a test group, then 10% of servers, then everything, a week apart, with backup and monitoring checks after each ring. The backup alerts now go to a monitored queue.
The lesson: hardening is a change like any other. Test it against the things that run at night, not just the things people use by day.
Common mistakes and troubleshooting
| Mistake or symptom | What happens | What to do instead |
|---|---|---|
| Applying a full baseline to all servers at once | Backups, agents and old apps break | Rings: test, pilot, then all; check backups after each |
| Disabling WinRM or its firewall rules | Remote management stops working | Keep WinRM open from admin subnets; use the firewall log |
| Blocking NTLM without auditing | Unknown dependencies fail | Audit first, fix the sources, then block |
| Turning off Defender “for performance” | No malware protection | Keep it on; add vendor-documented exclusions only |
| Inbound firewall rules for “Any” | Wide open services | Scope rules to admin and client subnets |
| Legacy audit categories mixed with advanced audit | Settings overwrite each other | Use Advanced Audit Policy only |
| Logs that nobody collects | Attacks go unnoticed | Forward events to a central system (Lesson 39) |
| BitLocker without recovery key backup | A locked disk is lost data | Back up recovery keys to AD before enabling |
| Hand-hardening each server | Drift and missed servers | GPOs or OSConfig, so settings are applied and kept |
Interview questions
Click a question to open it. Under each one you’ll find what the interviewer is really looking for, and one good way to answer.
Fresher level
1. What does hardening a server mean?
What they’re really checking: Do you know the idea?
How you could answer: Reducing its attack surface and strengthening settings: removing unused roles and services, requiring secure protocols, keeping antivirus and the firewall on, and enabling auditing.
2. Why should SMB1 be disabled?
What they’re really checking: Do you know legacy risks?
How you could answer: SMB1 is old and insecure; it was used by WannaCry. Modern Windows doesn’t need it and has it off by default.
3. How do you check the firewall status on a server?
What they’re really checking: Have you done it?
How you could answer: Get-NetFirewallProfile, or wf.msc. Check all three profiles are on and which profile is active.
2–5 years experience
4. What is SMB signing and why require it?
What they’re really checking: Do you understand relay attacks?
How you could answer: Signing adds a signature to each SMB packet, so it can’t be changed or relayed by an attacker in the middle. Windows Server 2025 requires it outbound by default; require it inbound on file servers.
5. How do you roll out a security baseline safely?
What they’re really checking: Do you manage risk?
How you could answer: Compare current settings with the baseline, apply to a test group, then pilot and wider rings, check backups, monitoring and apps after each, and keep a rollback plan.
6. Which audit events would you collect from DCs?
What they’re really checking: Do you know key event IDs?
How you could answer: 4624/4625 logons, 4771 failed Kerberos pre-auth, 4740 lockouts, 4728/4732/4756 group changes, 4720 user creation, 5136 directory changes, 4769 service tickets for Kerberoasting detection.
Senior level
7. How would you reduce NTLM across a company?
What they’re really checking: Do you plan migration?
How you could answer: Enable NTLM auditing on DCs and servers, collect events centrally, fix causes (IP paths, missing SPNs, old devices), add exceptions where needed, then restrict NTLM step by step, starting with servers that have none.
8. What’s the difference between Security Compliance Toolkit baselines and OSConfig?
What they’re really checking: Are you current with Server 2025?
How you could answer: SCT baselines are GPOs you import and link. OSConfig applies the baseline locally with PowerShell or Azure Arc and automatically corrects drift, which suits servers not managed by Group Policy.
9. How would you protect domain controllers specifically?
What they’re really checking: Do you think about Tier 0?
How you could answer: Physical and virtual isolation, Server Core, no internet browsing, spooler disabled, strict admin access from PAWs, LDAP signing and channel binding, auditing to a SIEM, regular patching and tested system state backups.
Quick quiz
Q1. What does “NotConfigured” for DefaultInboundAction mean?
- Inbound is allowed
- The built-in default, which blocks inbound
- The firewall is off
Show answer
B — The default is Block.
Q2. What did Server 2025 already require for SMB?
- Signing for outbound connections
- SMB1
- No signing at all
Show answer
A — You added inbound signing on SRV01.
Q3. Which event shows a failed Kerberos pre-authentication on a DC?
- 4624
- 4771
- 4740
Show answer
B — Code 0x18 means a bad password.
Q4. What should you do before blocking NTLM?
- Nothing
- Audit NTLM use and fix the sources
- Disable Kerberos
Show answer
B — Block only when the audit list is empty.
Q5. In the work story, what broke after the baseline?
- Printing
- Backups
- DNS
Show answer
B — The backup agents used NTLM.
Quick recap
- Windows Server hardening removes attack surface and strengthens settings in layers.
- Keep Defender and all firewall profiles on; log dropped packets.
- Require SMB signing, keep SMB1 off, disable TLS 1.0 and 1.1.
- Use GPOs (like C-DC-Hardening) or OSConfig so settings are applied and kept.
- Advanced Audit Policy gives you events like 4771; collect them centrally.
- Test hardening in rings, and audit before you block.
Next lesson
Lesson 24: Patching → You’ll read update history and build numbers, install updates with sconfig and PowerShell, plan maintenance windows, look at WSUS and Azure Update Manager, and fix a stuck update.
Further reading: Windows Server hardening
Want to go deeper into Windows Server hardening? Microsoft’s OSConfig security baselines guide explains the Server 2025 baseline, and the SMB signing guide covers signing defaults. You can also see the full plan for this course on the Windows Server Administration course page.
