Windows security audit with PowerShell: what to check on every PC
A quick Windows security audit checks about a dozen things on each PC: antivirus, firewall, disk encryption, patch age, local administrators, Remote Desktop, SMBv1, UAC, screen lock, the Guest account, pending reboots and listening ports. Every one can be checked with a read-only PowerShell command, so you can baseline a client's PCs in minutes before onboarding or after an incident.
Run these in an elevated PowerShell window (right-click Start → Terminal (Admin)). None of them change anything.
The checks, with commands
| Check | Command (read-only) | Good result |
|---|---|---|
| Defender real-time protection and signature age | Get-MpComputerStatus | Select RealTimeProtectionEnabled, AntivirusSignatureAge | True; signatures 0–2 days old |
| Firewall profiles | Get-NetFirewallProfile | Select Name, Enabled | Enabled on Domain, Private and Public |
| BitLocker | Get-BitLockerVolume -MountPoint C: | Select VolumeStatus, ProtectionStatus | FullyEncrypted, On (how to read it) |
| Last installed updates | Get-HotFix | Sort-Object InstalledOn -Descending | Select -First 5 | Most recent within ~30 days |
| Local administrators | Get-LocalGroupMember Administrators | Only the expected IT/admin accounts, not everyday users |
| Remote Desktop enabled | (Get-ItemProperty 'HKLM:\System\CurrentControlSet\Control\Terminal Server').fDenyTSConnections | 1 (disabled), or 0 only where RDP is needed and not internet-exposed (check exposure) |
| SMBv1 | Get-SmbServerConfiguration | Select EnableSMB1Protocol | False |
| UAC | (Get-ItemProperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System').EnableLUA | 1 |
| Guest account | Get-LocalUser Guest | Select Enabled | False |
| Pending reboot | Test-Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired' | False (True means updates aren't fully applied) |
| Listening ports | Get-NetTCPConnection -State Listen | Sort LocalPort | Select LocalAddress, LocalPort, OwningProcess | Only ports you can explain |
| PowerShell v2 (legacy engine) | Get-WindowsOptionalFeature -Online -FeatureName MicrosoftWindowsPowerShellV2Root | Disabled, or not present on newer builds |
How to read the results
- Fix FAILs first: antivirus off, firewall off, unencrypted laptops, SMBv1 on, everyday users in Administrators. These are the issues attackers and insurers care about most.
- Then WARNs: updates more than 30 days old, RDP enabled, pending reboots, unexplained listening ports.
- Record everything. Save the output per PC with the date. It's your baseline for the client, and evidence for an insurer or auditor that you checked.
Example findings on a typical 8-PC office
| Finding | PCs | Fix |
|---|---|---|
| All staff are local admins | 8 of 8 | Remove from Administrators; use a separate admin account for IT |
| BitLocker suspended after a BIOS update | 1 laptop | Resume-BitLocker -MountPoint C: |
| Last update 70+ days ago | 2 desktops | Fix Windows Update; check for a stuck pending reboot |
| RDP on, port forwarded on the router | 1 desktop | Remove the port forward today; move to VPN with MFA |
| SMBv1 enabled for an old copier | 1 desktop | Update copier firmware or scan to email/cloud; disable SMBv1 |
Screen lock check
The intro lists screen lock, so here's one way to check it. If a machine inactivity limit is set by policy, it shows here (in seconds):
(Get-ItemProperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System' -ErrorAction SilentlyContinue).InactivityTimeoutSecsNo value means no machine-wide limit is set by that policy. The screen may still lock through user settings, Intune or other policies, so confirm on the device if in doubt. Around 900 seconds (15 minutes) or less is a common target.
Checking several PCs at once
- With PowerShell remoting enabled on a domain or managed network, you can run a check across PCs from one admin machine, for example:
Remoting isn't on by default for every setup, so don't open it up just for this.Invoke-Command -ComputerName PC1,PC2,PC3 -ScriptBlock { Get-MpComputerStatus } | Select PSComputerName, RealTimeProtectionEnabled, AntivirusSignatureAge - With an RMM tool or Intune, run the same read-only commands as a script and collect the output centrally.
- On a small office with no management tools, run the checks locally on each PC and save the output to a shared folder, named by PC and date.
How often to audit
| When | Why |
|---|---|
| Onboarding a new client or PC | Baseline before you take responsibility (see client onboarding) |
| Monthly or quarterly | Catch drift: suspended BitLocker, stalled updates, new admins (see the monthly maintenance checklist) |
| Before an insurance renewal | Evidence for the application (see the renewal checklist) |
| After an incident | Confirm nothing was turned off or added |
| After a Windows upgrade | Check settings survived (see the Windows 11 upgrade checklist) |
What these checks don't cover
- Cloud settings such as MFA and admin roles in Microsoft 365 or Google Workspace (see Microsoft Secure Score and the Google Workspace settings checklist).
- Backups: a backup isn't proven until you restore from it (see the restore test).
- Admin password hygiene: whether every PC shares one local admin password (see local admin rights and LAPS).
- The network edge: router port forwards and firewall rules need checking on the router itself.
Run it faster
Running a dozen commands per PC gets old quickly. The free Windows Quick Security Check (MIT licensed) runs six of the key checks (Defender, firewall, BitLocker, update age, RDP and SMBv1), prints PASS / WARN / FAIL with a plain-English fix, and can save an HTML report. Read the script before running it, as with any script.
Use the results in your client onboarding, and compare them with what the client said on their cyber insurance questionnaire.
Windows Endpoint Security Audit $24
Runs 15 read-only checks per PC, including local admins and Guest, pending reboot, UAC, screen lock, PowerShell v2 and listening ports, and builds a color-coded HTML report.
Get the templatesFrequently asked questions
How do I check if BitLocker is on with PowerShell?
Run Get-BitLockerVolume in an elevated PowerShell window and check ProtectionStatus.
How do I check if SMBv1 is enabled?
Run Get-SmbServerConfiguration | Select EnableSMB1Protocol in PowerShell.
How do I check Windows Defender status with PowerShell?
Run Get-MpComputerStatus in an elevated PowerShell window and check RealTimeProtectionEnabled (should be True) and AntivirusSignatureAge (should be 0 to 2 days).
How do I list local administrators with PowerShell?
Run Get-LocalGroupMember Administrators in an elevated PowerShell window. Everyday user accounts shouldn't be in the list.
Are these PowerShell audit commands safe to run?
Yes. The commands listed are read-only Get and Test commands that report settings without changing them. Run them in an elevated window for complete results.
How do I audit security on several Windows PCs at once?
Use PowerShell remoting with Invoke-Command where it's already enabled, run the checks as a script through your RMM or Intune, or run them locally on each PC and save the output by PC name and date.
How often should I run a Windows security audit?
When onboarding a PC or client, monthly or quarterly to catch drift, before cyber insurance renewal, after an incident and after major Windows upgrades.