Windows Server Labs

Lab 9: Security baseline with OSConfig (45 min)

In this lab you harden your server with one command and then prove it's compliant. It's the strongest answer to the customer question "how do we secure our servers?"

What is OSConfig? It's the security configuration engine built into Windows Server 2025. Microsoft ships ready-made security baselines — about 320 settings for a workgroup server — and OSConfig applies them, reports compliance, and keeps them from drifting. Think of it as a building inspector who doesn't just write a report, but also fixes the doors and comes back to check they stay locked.

Your VM isn't in a domain, so you use the WorkgroupMember baseline.

Read this before you start. After the baseline, your Administrator password must be at least 14 characters, the account locks after 3 wrong passwords for 15 minutes, and copy-paste of files over RDP is turned off. Type carefully.

Steps

  1. RDP to your VM and open PowerShell as administrator.
  2. Take a "before" picture of a few settings, so you can compare later:

Get-SmbServerConfiguration | Select-Object EnableSMB1Protocol, RequireSecuritySignature Get-LocalUser Guest | Select-Object Name, Enabled Get-CimInstance -Namespace root\Microsoft\Windows\DeviceGuard -ClassName Win32_DeviceGuard | Select-Object VirtualizationBasedSecurityStatus, SecurityServicesRunning 3. Install the OSConfig module (answer Yes to the NuGet prompt):

Install-Module -Name Microsoft.OSConfig -Scope AllUsers -Force Get-Module -ListAvailable -Name Microsoft.OSConfig 4. Apply the baseline:

Set-OSConfigDesiredConfiguration -Scenario SecurityBaseline/WindowsServer/2025/WorkgroupMember -Default 5. Restart the VM. When you sign back in, you're asked to change the Administrator password — use 14+ characters. 6. Check compliance. Every line shows a setting, its status, and the reason if it's not compliant:

Get-OSConfigDesiredConfiguration -Scenario SecurityBaseline/WindowsServer/2025/WorkgroupMember | Format-Table Name, @{ Name = "Status"; Expression = { $_.Compliance.Status } }, @{ Name = "Reason"; Expression = { $_.Compliance.Reason } } -AutoSize -Wrap 7. Run the "before" commands from step 2 again. What changed? You should see SMB signing required, SMBv1 off and the Guest account disabled. 8. Customize one setting the supported way, and keep drift control on. For example, allow RDP drive redirection again:

Set-OSConfigDesiredConfiguration -Scenario SecurityBaseline/WindowsServer/2025/WorkgroupMember -Name RemoteDesktopServicesDoNotAllowDriveRedirection -Value 0

Restart to apply it.

Close the loop with Azure. Go back to Policy > Compliance from Lab 4. After the next evaluation (about 30 minutes), most of the rules that failed now pass — the same baseline, applied locally by OSConfig and reported centrally by Azure. Do the same in Defender for Cloud recommendations (Lab 7) and Best Practices Assessment (Lab 8).

Check yourself

Customer talking points