Windows Server hardening: baselines, protocols and auditing

A fresh install of Windows Server is fairly safe out of the box, but “fairly safe” won’t do once the box is holding payroll data. Windows Server hardening is the work of switching off what you don’t use, insisting on stronger protocols and keeping enough logs that you can tell when something has gone wrong.

You’ll start by checking Defender and the firewall, then put a hardening GPO on your DCs (it also covers the spooler from Lesson 18), require SMB signing on SRV01, switch off the old TLS versions and set up audit policy. After that you’ll see how the OSConfig baseline in Server 2025 works, and at the end you’ll lock yourself out by adding one rule too many.

TimeYou needBy the end you can
About 90 minutesDC01, SRV01 and CL01 from Lesson 22Check 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 stop at locking the front door. Before she goes home she shuts the windows nobody uses, puts the cash in the safe, sets the alarm and leaves the camera recording, and hardening a server follows the same routine: switch off services you don’t need (the windows), require strong protocols (better locks), encrypt the disks (the safe) and turn on auditing (the camera).

Like a shop with so many locks that the staff can’t get in next morning, a server can be locked down so tightly that it stops doing its job, which is why good hardening gets tested before it goes live.

Engineer's View

Baselines, protocols, encryption and audit

Security baselines are the settings Microsoft recommends for each Windows version, and they come as GPOs in the Security Compliance Toolkit. On Windows Server 2025 you can also use OSConfig, which applies the baseline locally through PowerShell and puts settings back by itself if they drift.

Protocols: require SMB signing so nobody can relay or tamper with SMB traffic (Server 2025 already requires it for outbound connections, and DCs require it inbound), keep SMB1 removed, switch off TLS 1.0 and 1.1 and cut down on NTLM. Defender Antivirus comes built into Server 2025, so leave it on and updated, and add exclusions only where a vendor asks for them.

Firewall: leave all three profiles on, block inbound by default and open only the ports each role needs. BitLocker protects the data if a disk or VM is stolen, and its recovery keys should be stored in AD. Our lab’s SRV01 runs BIOS firmware with no virtual TPM, so here you’ll plan BitLocker instead of switching it on.

Auditing: use Advanced Audit Policy rather than the old legacy categories, cover logon, account management, Kerberos, directory service changes and policy changes, and send the events somewhere central, because without logs there’s nothing to investigate.

How it works, step by step

Hardening works in layers, and each layer assumes the one outside it might fail:

Windows Server hardening in layers: network, protocols, services, malware, data and evidence

Push hardening out to groups of servers with GPOs, so a new server picks up the same protection as soon as it joins the right OU, and always try a change on one server with a snapshot before it goes wider.

Here are the pieces you’ll put in place:

Windows Server hardening in the lab: SRV01 baseline, DC hardening GPO, firewall and Defender
  1. Check Defender, firewall profiles and SMB signing as they are.
  2. C-DC-Hardening GPO on Domain Controllers: spooler disabled, advanced auditing.
  3. SMB signing required on SRV01, and TLS 1.0/1.1 turned off.
  4. Test auditing with a failed sign-in.
  5. OSConfig baseline on SRV01, after a snapshot.

Hands-on Lab: Windows Server hardening on SRV01 and the DCs

Before you run any command, double-check it

Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.

Start DC01, SRV01 and CL01 and take a snapshot of each one first by running 'DC01','SRV01','CL01' | ForEach-Object { VBoxManage snapshot $_ take 'Before hardening' } on your laptop. Do the rest of the 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, LogBlocked

You 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 Windows uses its built-in default, which is Block. Next, turn on logging of dropped packets so you can see what the firewall is stopping:

On SRV01:

Set-NetFirewallProfile -All -LogBlocked True -LogMaxSizeKilobytes 16384
Get-NetFirewallProfile -Name Domain | Select-Object LogBlocked, LogFileName

You 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 RequireSecuritySignature

You should see something like this:

RequireSecuritySignature
------------------------
                    True

RequireSecuritySignature EnableSMB1Protocol
------------------------ ------------------
                   False              False

RequireSecuritySignature
------------------------
                    True

Server 2025 already requires signing when SRV01 makes outbound connections, and SMB1 is already off, but until now the file server didn’t insist on signing for inbound connections. In production you’d set this through the GPO setting “Microsoft network server: Digitally sign communications (always)” so that 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, DisabledByDefault

You 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                 1

SCHANNEL changes only take effect after a restart, so restart SRV01. Recent Windows versions avoid these old versions anyway, but setting the keys yourself makes your intent clear and holds even if some app tries to switch them back on. After this, IIS on SRV01 (Lesson 25) will speak only 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, StartType

You 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  Disabled

The spooler setting you applied by hand in Lesson 18 is now enforced by policy, so any new DC picks it up automatically, and the audit settings make the 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 0x18

Event 4771 means Kerberos pre-authentication failed, and code 0x18 tells you it was a bad password; the event also shows which account it was and which address it came from. If you see a lot of these from one address in a short time, someone is guessing passwords, and the lockout policy from Lesson 19 is what slows them down.

✅ Checkpoint: DC01 logged event 4771 for priya.sharma from 10.0.0.150 with code 0x18.

Windows Server hardening lab: event 4771 records a failed Kerberos sign-in
DC01 recorded Priya’s wrong password as event 4771 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 8

You should see something like this:

Name                             Status
----                             ------
AuditAccountLockout              Compliant
AuditApplicationGroupManagement  Compliant
AuditAuthenticationPolicyChange  Compliant
AuditAuthorizationPolicyChange   Compliant
AuditComputerAccountManagement   Compliant
AuditCredentialValidation        Compliant
AuditDetailedFileShare           Compliant
AuditDistributionGroupManagement Compliant

OSConfig has now applied a few hundred settings and will put them back if anything changes them. Restart SRV01 and check from CL01 that S:, the printer and the intranet SPN still work. That check is why you took the snapshot, because a baseline should always be tested and 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

Badly done hardening causes outages, so 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,PSSessionStateBroken

Now every remote tool that uses WinRM fails, whether it’s Server Manager, Windows Admin Center or your own scripts, and if SRV01 were a Server Core box in a data centre you’d need console access to fix it. Use the firewall log you turned on in step 1 to see what’s being blocked:

On SRV01:

Select-String -Path C:\Windows\System32\LogFiles\Firewall\pfirewall.log -Pattern ' 5985 ' | Select-Object -Last 2

You 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 - - - RECEIVE

Fix 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.

Windows Server hardening lab: WinRM error and firewall log drops on port 5985
With the WinRM rules off, remote commands time out and the firewall log shows the drops.

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 DWord

On 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\Departments

You’ll see something like this:

Finance
Get-ChildItem : Access is denied

Kerberos still works when you use the name, but anything that relied on NTLM, such as IP paths, old scanners and some backup agents, is now refused, and nobody had a list of what those were. On SRV01, the Microsoft-Windows-NTLM/Operational log records every blocked request.

Fix it: switch to audit mode, collect events for a few weeks, sort out the sources, and block only after that:

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, Id

In audit mode the log lists everyone who still uses NTLM without blocking them, and that list becomes your work plan. Turn on blocking only when the list is 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

An audit had flagged missing settings at a hospital, so one evening the security team applied a full security baseline GPO to every server in one go. Next morning everything looked fine. Three nights later the backup report showed failures on 60 servers. The backup agents were still using NTLM with a service account and an old protocol option, and the baseline’s NTLM and SMB settings had blocked both. It took three days for anyone to notice, because the backup alerts went to a mailbox nobody read. The team rolled back two settings and ran an emergency backup, and then spent a month with the vendor on an agent upgrade that supported Kerberos and signing.

The fix: they now roll baselines out in rings, first a test group, then 10% of servers, then everything, with a week between rings and a check of backups and monitoring after each one. The backup alerts go to a queue that someone watches.

The lesson: treat hardening like any other change, and test it against the jobs that run at night as well as the things people use during the day.

Common mistakes and troubleshooting

Mistake or symptomWhat happensWhat to do instead
Applying a full baseline to all servers at onceBackups, agents and old apps breakRings: test, pilot, then all; check backups after each
Disabling WinRM or its firewall rulesRemote management stops workingKeep WinRM open from admin subnets; use the firewall log
Blocking NTLM without auditingUnknown dependencies failAudit first, fix the sources, then block
Turning off Defender “for performance”No malware protectionKeep it on; add vendor-documented exclusions only
Inbound firewall rules for “Any”Wide open servicesScope rules to admin and client subnets
Legacy audit categories mixed with advanced auditSettings overwrite each otherUse Advanced Audit Policy only
Logs that nobody collectsAttacks go unnoticedForward events to a central system (Lesson 39)
BitLocker without recovery key backupA locked disk is lost dataBack up recovery keys to AD before enabling
Hand-hardening each serverDrift and missed serversGPOs or OSConfig, so settings are applied and kept

Interview questions

Click a question to open it. Each one is phrased the way an interviewer would ask it, and underneath you’ll find why they ask it and one way you could answer in your own words.

Fresher level

1. Your manager asks you to harden a new server before it goes live. What does hardening mean to you?

Why they ask this: They’re checking that you get the basic idea and can name practical steps, not only the word.

How you might answer: For me hardening means making the server harder to attack. I’d remove the roles and services it doesn’t use, require secure protocols, keep antivirus and the firewall on, and turn on auditing so we can see what’s happening on the box.

2. An old scanner only works if SMB1 is turned on. Why would you push back on enabling it?

Why they ask this: They want to know you understand the risk of legacy protocols and can explain it to people who want them back.

How you might answer: SMB1 is old and insecure, and WannaCry used it to spread. Modern Windows doesn’t need it and ships with it off, so I’d rather replace or update the scanner than open that hole on a server.

3. How would you quickly check if the Windows firewall is on for a server?

Why they ask this: They want to know whether you’ve checked firewall status yourself and know there’s more than one profile.

How you might answer: I’d run Get-NetFirewallProfile or open wf.msc, and check that all three profiles are on and which one is active right now.

2–5 years experience

4. Can you explain SMB signing to a new team member, and why we should require it?

Why they ask this: They want to see that you understand relay attacks and the current Windows defaults.

How you might answer: I’d tell them signing puts a signature on every SMB packet, so someone sitting in the middle can’t change it or relay it. Windows Server 2025 already requires signing for outbound connections, and on file servers I’d require it for inbound as well.

5. Security hands you a new baseline and says, “Apply this to all servers.” How would you roll it out without breaking apps?

Why they ask this: They’re looking for someone who manages risk with testing, rings and a way back.

How you might answer: I’d start by comparing our current settings with the baseline so I know what will change. Then it goes to a test group, a pilot ring and wider rings after that, and after each ring I check backups, monitoring and the apps. I’d also have a rollback plan ready before I start.

6. You’re setting up log collection from domain controllers. Which security events would you make sure to collect?

Why they ask this: They want to check that you know the key event IDs and what each one helps you catch.

How you might answer: For logons I’d collect 4624 and 4625, plus 4771 for failed Kerberos pre-authentication and 4740 for lockouts. For changes I’d want 4728, 4732 and 4756 for group changes, 4720 for new users and 5136 for directory changes. I’d also pick up 4769 for service tickets, because that’s how you spot Kerberoasting.

Senior level

7. Your company wants to move away from NTLM. How would you plan that across hundreds of servers?

Why they ask this: They want a careful plan driven by data, not one big switch that breaks old apps.

How you might answer: I’d turn on NTLM auditing on the DCs and servers first and collect the events centrally, then fix the causes, things like access by IP, missing SPNs and old devices. Where an exception is genuinely needed I’d add it, and then restrict NTLM step by step, starting with the servers that already show no NTLM use.

8. What’s the difference between Security Compliance Toolkit baselines and OSConfig, and when would you use each?

Why they ask this: They want to know if you’re up to date with the Windows Server 2025 options and can choose the right tool.

How you might answer: SCT baselines are GPOs you import and link, so they fit servers that are managed by Group Policy. OSConfig applies the baseline locally through PowerShell or Azure Arc and fixes drift on its own, so I’d use it for servers that Group Policy doesn’t reach.

9. Domain controllers are your most important servers. What extra protection would you give them?

Why they ask this: They want to see that you treat DCs as Tier 0 and think through the ways they could be attacked.

How you might answer: I’d keep them isolated, physically and virtually, run Server Core, block internet browsing, disable the spooler and allow admin access only from PAWs. On top of that I’d require LDAP signing and channel binding, send the audit logs to a SIEM, patch on a regular schedule and test the system state backups.

Quick quiz

Q1. What does “NotConfigured” for DefaultInboundAction mean?

  1. Inbound is allowed
  2. The built-in default, which blocks inbound
  3. The firewall is off
Show answer

B — The default is Block.

Q2. What did Server 2025 already require for SMB?

  1. Signing for outbound connections
  2. SMB1
  3. 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?

  1. 4624
  2. 4771
  3. 4740
Show answer

B — Code 0x18 means a bad password.

Q4. What should you do before blocking NTLM?

  1. Nothing
  2. Audit NTLM use and fix the sources
  3. Disable Kerberos
Show answer

B — Block only when the audit list is empty.

Q5. In the work story, what broke after the baseline?

  1. Printing
  2. Backups
  3. 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 every firewall profile on, and 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, and you should collect them centrally.
  • Roll hardening out in rings, and audit before you block.

Next lesson

Lesson 24: Patching → Next 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 an update that gets stuck.

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.

Scroll to Top

This website uses cookies

We use a few cookies to keep this site working. If you allow it, we also use Google Analytics to count visits so we can improve our lessons. You can accept all, deny the optional ones, or choose what to allow.