Small Business Security Templates
Home › Windows PowerShell audit

Windows security audit with PowerShell: what to check on every PC

By William Todd, IT support and cybersecurity engineer · Updated 2026-11-22

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

CheckCommand (read-only)Good result
Defender real-time protection and signature ageGet-MpComputerStatus | Select RealTimeProtectionEnabled, AntivirusSignatureAgeTrue; signatures 0–2 days old
Firewall profilesGet-NetFirewallProfile | Select Name, EnabledEnabled on Domain, Private and Public
BitLockerGet-BitLockerVolume -MountPoint C: | Select VolumeStatus, ProtectionStatusFullyEncrypted, On (how to read it)
Last installed updatesGet-HotFix | Sort-Object InstalledOn -Descending | Select -First 5Most recent within ~30 days
Local administratorsGet-LocalGroupMember AdministratorsOnly the expected IT/admin accounts, not everyday users
Remote Desktop enabled(Get-ItemProperty 'HKLM:\System\CurrentControlSet\Control\Terminal Server').fDenyTSConnections1 (disabled), or 0 only where RDP is needed and not internet-exposed (check exposure)
SMBv1Get-SmbServerConfiguration | Select EnableSMB1ProtocolFalse
UAC(Get-ItemProperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System').EnableLUA1
Guest accountGet-LocalUser Guest | Select EnabledFalse
Pending rebootTest-Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired'False (True means updates aren't fully applied)
Listening portsGet-NetTCPConnection -State Listen | Sort LocalPort | Select LocalAddress, LocalPort, OwningProcessOnly ports you can explain
PowerShell v2 (legacy engine)Get-WindowsOptionalFeature -Online -FeatureName MicrosoftWindowsPowerShellV2RootDisabled, or not present on newer builds

How to read the results

Example findings on a typical 8-PC office

FindingPCsFix
All staff are local admins8 of 8Remove from Administrators; use a separate admin account for IT
BitLocker suspended after a BIOS update1 laptopResume-BitLocker -MountPoint C:
Last update 70+ days ago2 desktopsFix Windows Update; check for a stuck pending reboot
RDP on, port forwarded on the router1 desktopRemove the port forward today; move to VPN with MFA
SMBv1 enabled for an old copier1 desktopUpdate 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).InactivityTimeoutSecs

No 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

How often to audit

WhenWhy
Onboarding a new client or PCBaseline before you take responsibility (see client onboarding)
Monthly or quarterlyCatch drift: suspended BitLocker, stalled updates, new admins (see the monthly maintenance checklist)
Before an insurance renewalEvidence for the application (see the renewal checklist)
After an incidentConfirm nothing was turned off or added
After a Windows upgradeCheck settings survived (see the Windows 11 upgrade checklist)

What these checks don't cover

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 templates

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

Related guides