-
Notifications
You must be signed in to change notification settings - Fork 0
Usage Guide
Comprehensive guide to using the Windows Security Audit Script for security assessment, compliance validation, and remediation across the 16 supported frameworks.
Version: 6.1.2 Last Updated: 2026-04-25
- Quick Reference
- Command-Line Parameters
- Module Selection
- Output Configuration
- Performance and Caching
- Logging
- Help System
- Remediation Features
- Baseline Drift Comparison
- Group Policy Export
- v6.1 Cross-Cutting Capabilities
- Common Use Cases
- Standalone Module Execution
- Automation and Scheduling
- Best Practices
# Default: run all 16 modules, generate HTML + JSON
.\Windows-Security-Audit.ps1
# Targeted modules with parallel execution
.\Windows-Security-Audit.ps1 -Modules CIS,STIG,NIST -Parallel -Workers 8
# Multi-format output to specific location
.\Windows-Security-Audit.ps1 -OutputFormat All -OutputPath .\audits\Q2-2026
# Audit with all v6.1 enrichments
.\Windows-Security-Audit.ps1 -ShowRiskPriority -ShowCorrelations -ShowCompensatingControls
# Apply remediation bundle
.\Windows-Security-Audit.ps1 -RemediationBundle EssentialEightLevel1 -AutoRemediate -RollbackPath .\rollback.ps1
# Show comprehensive help
.\Windows-Security-Audit.ps1 -HelpThe orchestrator accepts 25 named parameters plus support for free-form help invocation forms.
| Parameter | Type | Default | Description |
|---|---|---|---|
-Modules |
String[] | All |
Modules to execute. Valid: acsc, cis, cisa, cmmc, core, enisa, gdpr, hipaa, iso27001, ms, ms-defenderatp, nist, nsa, pcidss, soc2, stig, All. Case-insensitive. |
-OutputPath |
String | .\reports\audit-yyyyMMdd-HHmmss |
Path/base name for output files (extension auto-appended). |
-OutputFormat |
String | HTML |
One of: HTML, JSON, CSV, XML, Console, All. |
-ListModules |
Switch | False |
Print list of available modules and exit. |
| Parameter | Type | Description |
|---|---|---|
-Help |
Switch | Display comprehensive 10-section help screen. |
-H |
Switch | Alias for -Help. |
-? |
Switch | Alias for -Help. |
-ShowHelp |
Switch | Alias for -Help. |
Plus help can be invoked as help, -help, --help, --h, /?, /help, /h via [Parameter(ValueFromRemainingArguments=$true)].
| Parameter | Type | Default | Description |
|---|---|---|---|
-Parallel |
Switch | False |
Execute modules concurrently via RunspacePool. |
-Workers |
Int | 4 |
Number of parallel workers (1-16). Auto-clamped to module count. |
-NoCache |
Switch | False |
Disable shared data cache (debugging only; ~3-5× slower). |
-ShowProfile |
Switch | False |
Print per-module execution timing summary. |
| Parameter | Type | Default | Description |
|---|---|---|---|
-LogFile |
String | auto-generated | Path to log file. Auto-creates .\logs\audit-yyyyMMdd-HHmmss.log if omitted. |
-LogLevel |
String | INFO |
One of: DEBUG, INFO, WARNING, ERROR, CRITICAL. |
-JsonLog |
Switch | False |
Emit log entries as JSON (for SIEM ingestion). |
-Quiet |
Switch | False |
Suppress console output (file logging continues). |
-Verbose |
Switch | False |
Standard PowerShell verbose output (also bumps log level). |
| Parameter | Type | Default | Description |
|---|---|---|---|
-RemediateIssues |
Switch | False |
Interactively remediate ALL findings (Fail + Warning + Info). |
-RemediateIssues_Fail |
Switch | False |
Remediate only Fail-status findings. |
-RemediateIssues_Warning |
Switch | False |
Remediate only Warning-status findings. |
-RemediateIssues_Info |
Switch | False |
Remediate only Info-status findings. |
-AutoRemediate |
Switch | False |
Apply remediations without per-item prompting (still requires YES confirmation). |
-RemediationFile |
String | (none) | JSON file containing specific issues to remediate (typically exported from HTML report). |
-RemediationBundle |
String | (none) | Predefined bundle: DisableLegacyProtocols, HardenAuthentication, EnableAuditLogging, LockDownRDP, EssentialEightLevel1. |
-RollbackPath |
String | (none) | Path to write inverse-operation rollback script. |
-ExportGPO |
String | (none) | Path to write Group Policy .pol file from registry remediations. |
| Parameter | Type | Default | Description |
|---|---|---|---|
-Baseline |
String | (none) | Path to previous JSON audit for drift comparison. |
-ShowRiskPriority |
Switch | False |
Add 1-100 risk priority score to each finding. |
-ShowCorrelations |
Switch | False |
Group findings testing the same underlying control across modules. |
-ShowCompensatingControls |
Switch | False |
Flag failed checks where a passing related control mitigates risk. |
.\Windows-Security-Audit.ps1
[-Modules <String[]>]
[-OutputPath <String>]
[-OutputFormat <String>]
[-ListModules]
[-Help] [-H] [-?] [-ShowHelp]
[-Parallel] [-Workers <Int>]
[-NoCache] [-ShowProfile]
[-LogFile <String>]
[-LogLevel <String>]
[-JsonLog] [-Quiet]
[-RemediateIssues]
[-RemediateIssues_Fail]
[-RemediateIssues_Warning]
[-RemediateIssues_Info]
[-AutoRemediate]
[-RemediationFile <String>]
[-RemediationBundle <String>]
[-RollbackPath <String>]
[-ExportGPO <String>]
[-Baseline <String>]
[-ShowRiskPriority]
[-ShowCorrelations]
[-ShowCompensatingControls]
[-Verbose]| Module | Framework Focus | Checks |
|---|---|---|
acsc |
ACSC Essential Eight + ISM/PSPF | 170 |
cis |
CIS Controls v8 + IG2/IG3 + Companion Guides | 260 |
cisa |
CISA Best Practices + KEV + ZTMM + CPGs | 289 |
cmmc |
CMMC 2.0 L1/L2/L3 + DFARS + 800-172 | 145 |
core |
Foundational Windows Security Baseline | 243 |
enisa |
ENISA + NIS2 + DORA + CRA | 248 |
gdpr |
GDPR + ePrivacy + Schrems II | 183 |
hipaa |
HIPAA + 405(d) HICP + HITECH + 800-66 R2 | 237 |
iso27001 |
ISO 27001:2022 + 27002/27017/27018/27701 | 286 |
ms |
Microsoft Security Baseline (Win11 24H2 / Server 2025) | 367 |
ms-defenderatp |
Microsoft Defender for Endpoint | 155 |
nist |
NIST SP 800-53 R5 + CSF 2.0 + 800-171 + 800-207 | 520 |
nsa |
NSA Cybersecurity + AD hardening + Top 10 | 225 |
pcidss |
PCI DSS v4.0/v4.0.1 + PIN Security + 3DS | 279 |
soc2 |
SOC 2 Trust Service Criteria | 162 |
stig |
DISA STIGs + SRG cross-mapping | 225 |
| TOTAL | 16 frameworks | 3,994 |
Run all modules (default):
.\Windows-Security-Audit.ps1
.\Windows-Security-Audit.ps1 -Modules AllSingle module:
.\Windows-Security-Audit.ps1 -Modules coreMultiple modules:
.\Windows-Security-Audit.ps1 -Modules cis,stig,nistGovernment / Federal compliance:
.\Windows-Security-Audit.ps1 -Modules stig,nist,cisa,cmmcHealthcare:
.\Windows-Security-Audit.ps1 -Modules hipaa,nist,iso27001Financial services / payment processing:
.\Windows-Security-Audit.ps1 -Modules pcidss,nist,iso27001,soc2Privacy compliance:
.\Windows-Security-Audit.ps1 -Modules gdpr,iso27001,soc2Australian government / defence:
.\Windows-Security-Audit.ps1 -Modules acsc,iso27001EU / NIS2 alignment:
.\Windows-Security-Audit.ps1 -Modules enisa,iso27001,gdprMicrosoft / endpoint protection:
.\Windows-Security-Audit.ps1 -Modules ms,ms-defenderatp,coreList available modules and exit:
.\Windows-Security-Audit.ps1 -ListModules| Format | Switch | Use Case |
|---|---|---|
| HTML (default) | -OutputFormat HTML |
Interactive review with filters, sortable tables, export modal |
| JSON | -OutputFormat JSON |
Programmatic access, automation, SIEM ingestion |
| CSV | -OutputFormat CSV |
Spreadsheet analysis, ticket creation |
| XML | -OutputFormat XML |
XSL-styled workbook (renders in browser); SIEM systems expecting XML |
| Console | -OutputFormat Console |
Terminal-only; no file output |
| All | -OutputFormat All |
Generate HTML + JSON + CSV + XML simultaneously |
# Default HTML output (a JSON companion is always generated alongside HTML)
.\Windows-Security-Audit.ps1
# JSON only with custom path
.\Windows-Security-Audit.ps1 -OutputFormat JSON -OutputPath .\audits\Q2-baseline.json
# All four file formats with shared base name
.\Windows-Security-Audit.ps1 -OutputFormat All -OutputPath .\audits\Q2-2026
# Console-only (good for piping or quick review)
.\Windows-Security-Audit.ps1 -Modules core -OutputFormat ConsoleThe HTML report's Export toolbar offers six additional formats:
- CSV — flat tabular export
- Excel (.xls) — opens directly in Microsoft Excel
- JSON — same shape as native JSON
- XML Workbook — XSL-styled XML
- SIEM XML — SIEM-compatible structured XML
- Plain Text (.txt) — human-readable text dump
Selective export by checking individual rows or filtering by module/category before clicking Export.
.\Windows-Security-Audit.ps1Modules run one at a time; the shared data cache pre-populates registry, services, audit policy, and password policy queries during warmup, eliminating redundant queries (~3.3× speedup over uncached execution).
# Default 4 workers
.\Windows-Security-Audit.ps1 -Parallel
# Specify worker count (1-16)
.\Windows-Security-Audit.ps1 -Parallel -Workers 8
# Combined with profiling
.\Windows-Security-Audit.ps1 -Parallel -Workers 8 -ShowProfileThe orchestrator uses RunspacePool concurrency. Worker count is automatically clamped to min($Workers, $modulesToRun.Count, 16).
.\Windows-Security-Audit.ps1 -ShowProfileSample output:
=== Module Performance Profile ===
acsc 5.32s (170 checks)
cis 6.46s (260 checks)
cisa 8.71s (289 checks)
...
Total wall time: 77.94s
# Disable cache (debugging only)
.\Windows-Security-Audit.ps1 -NoCacheWithout specifying -LogFile, the script automatically generates a timestamped log file:
.\logs\audit-yyyyMMdd-HHmmss.log
Console output is mirrored to this file with color-coded format.
| Level | Use |
|---|---|
DEBUG |
Deep diagnostic trace (invocation, module timings, parameter values) |
INFO (default) |
Standard progress messages |
WARNING |
Non-fatal issues |
ERROR |
Module failures or critical errors |
CRITICAL |
Audit-aborting failures |
# Default INFO level
.\Windows-Security-Audit.ps1
# Deep debugging
.\Windows-Security-Audit.ps1 -LogLevel Debug -Verbose
# Custom log file path
.\Windows-Security-Audit.ps1 -LogFile .\diagnostic-2026-04-25.log
# JSON-formatted log for SIEM
.\Windows-Security-Audit.ps1 -JsonLog -LogFile .\siem-audit.json
# Suppress console output (file logging only)
.\Windows-Security-Audit.ps1 -Quiet# Multiple equivalent invocations
.\Windows-Security-Audit.ps1 -Help
.\Windows-Security-Audit.ps1 -H
.\Windows-Security-Audit.ps1 -?
.\Windows-Security-Audit.ps1 -ShowHelp
.\Windows-Security-Audit.ps1 help
.\Windows-Security-Audit.ps1 -help
.\Windows-Security-Audit.ps1 --help
.\Windows-Security-Audit.ps1 --h
.\Windows-Security-Audit.ps1 /?
.\Windows-Security-Audit.ps1 /help
.\Windows-Security-Audit.ps1 /hThe help screen has 10 sections: Banner, Synopsis, Description, Frameworks, Parameters by Group, Examples, Bundles, Quick Reference, Requirements, More Information.
# Standard PowerShell comment-based help
Get-Help .\Windows-Security-Audit.ps1
Get-Help .\Windows-Security-Audit.ps1 -Detailed
Get-Help .\Windows-Security-Audit.ps1 -Examples
Get-Help .\Windows-Security-Audit.ps1 -FullWithout any remediation switches, the script performs only read-only checks. Safe to run on production:
.\Windows-Security-Audit.ps1
# No system changes# Interactive prompt for every Fail/Warning/Info finding
.\Windows-Security-Audit.ps1 -RemediateIssues
# Filter by status
.\Windows-Security-Audit.ps1 -RemediateIssues_Fail
.\Windows-Security-Audit.ps1 -RemediateIssues_Warning
.\Windows-Security-Audit.ps1 -RemediateIssues_Info
# Combine
.\Windows-Security-Audit.ps1 -RemediateIssues_Fail -RemediateIssues_WarningFor each finding, you'll see:
[Issue 1 of 31]
Module: CIS
Category: CIS - Account Policy
Severity: High
Status: Fail
Message: Maximum password age exceeds policy (current: 0 days)
Remediation: net accounts /maxpwage:90
Apply this remediation? (Y/N/A=All/S=Skip Remaining/Q=Quit):
# Apply all qualifying remediations after summary confirmation
.\Windows-Security-Audit.ps1 -RemediateIssues_Fail -AutoRemediatePre-confirmation summary:
=== Remediation Plan ===
Total remediations: 31
Critical: 4
High: 18
Medium: 9
Reboot required: 3
Logoff required: 2
Service restart: 5
Network impact: 1
Destructive: 0
Type YES to proceed, or anything else to cancel:
| Bundle | Coverage |
|---|---|
| DisableLegacyProtocols | SMBv1, TLS 1.0/1.1, SSLv2/3, LLMNR, NetBIOS, LM hash, NTLMv1, RC4, 3DES |
| HardenAuthentication | UAC, LSA Protection, Credential Guard, NTLM levels, Anonymous, Cached Logons, Password Policy, WDigest |
| EnableAuditLogging | Process Creation, ScriptBlockLogging, ModuleLogging, Transcription, Audit Policy, Event Log Size |
| LockDownRDP | RDP enable, NLA, MinEncryption, SecurityLayer, IdleTimeout, MaxIdleTime |
| EssentialEightLevel1 | ACSC E1-E8: AppControl, Patch Apps, Macros, App Hardening, Admin Privs, Patch OS, MFA, Backups |
# Legacy protocol hardening
.\Windows-Security-Audit.ps1 -RemediationBundle DisableLegacyProtocols -AutoRemediate
# Essential Eight L1 with rollback
.\Windows-Security-Audit.ps1 -RemediationBundle EssentialEightLevel1 -AutoRemediate -RollbackPath .\e8-rollback.ps1# Step 1: Run audit, open HTML report, check boxes for issues to fix
.\Windows-Security-Audit.ps1
# Step 2: In HTML report, click "Export Selected (JSON)" → save as .\selected.json
# Step 3: Apply only the selected items
.\Windows-Security-Audit.ps1 -RemediationFile .\selected.json -AutoRemediate# Apply remediations and capture rollback
.\Windows-Security-Audit.ps1 -RemediateIssues_Fail -AutoRemediate -RollbackPath .\rollback.ps1
# Later: reverse the changes
.\rollback.ps1The generated rollback script contains:
- Original registry values (read before modification)
- Original service states (Running/Stopped, StartupType)
- Inverse
auditpolcommands - Comments documenting what each line reverses
.\Windows-Security-Audit.ps1 -OutputFormat JSON -OutputPath .\baselines\golden-2026-04-25.json.\Windows-Security-Audit.ps1 -Baseline .\baselines\golden-2026-04-25.jsonThe HTML report's Drift Analysis panel shows:
=== Baseline Drift ===
New failures (regressions): 7
Resolved findings (improvements): 12
Stable findings: 3,892
Newly introduced: 83
Removed: 0
- Quarterly audits — capture Q1 baseline, compare Q2/Q3/Q4
- Pre/post change validation — capture before patch deployment, compare after
- Compliance evidence — show regulators "we maintained X% compliance from Date A to Date B"
# Generate GPO from failing checks
.\Windows-Security-Audit.ps1 -RemediateIssues_Fail -ExportGPO .\Hardening-Q2-2026.polImport the .pol file into a Group Policy Object:
- Open Group Policy Management Console (gpmc.msc)
- Edit the target GPO
- Navigate to Computer Configuration → Preferences → Windows Settings → Registry
- Right-click → Import → select the generated
.polfile
Note: only registry-modifying remediations are exported.
.\Windows-Security-Audit.ps1 -ShowRiskPriorityAdds 1-100 score to each finding:
- 80-100 — Critical priority (Critical/High severity + high exploitability + internet-facing)
- 60-79 — High priority
- 40-59 — Medium priority
- 20-39 — Low priority
- 1-19 — Informational
.\Windows-Security-Audit.ps1 -ShowCorrelationsGroups findings testing the same underlying control:
[Correlation: SMBv1 Disabled]
Tested by 7 modules — all PASS
Modules: core, stig, ms, nsa, cisa, hipaa, enisa
[Correlation: BitLocker Active on System Drive]
Tested by 10 modules — 8 PASS, 2 FAIL
PASS: core, stig, ms, nist, hipaa, gdpr, iso27001, pcidss
FAIL: cmmc, acsc
.\Windows-Security-Audit.ps1 -ShowCompensatingControlsFlags Fail findings where related controls compensate:
[Compensating Control Detected]
Failed check: LSA Protection (RunAsPPL) — Fail
Compensated by: Credential Guard active (passes)
Mitigation: Credential Guard provides VBS-isolated credential storage
.\Windows-Security-Audit.ps1 -ShowRiskPriority -ShowCorrelations -ShowCompensatingControls.\Windows-Security-Audit.ps1 -Modules core -OutputFormat HTML.\Windows-Security-Audit.ps1 -Parallel -Workers 8 -OutputFormat All -ShowRiskPriority -ShowCorrelations.\Windows-Security-Audit.ps1 -OutputFormat JSON -OutputPath .\ci-audit.json -Quiet
$results = Get-Content .\ci-audit.json | ConvertFrom-Json
if ($results.ExecutionInfo.ComplianceScore -lt 85) {
Write-Error "Compliance below threshold"
exit 1
}# Before patch
.\Windows-Security-Audit.ps1 -OutputFormat JSON -OutputPath .\baselines\pre-patch.json
# Apply patch...
# After patch
.\Windows-Security-Audit.ps1 -Baseline .\baselines\pre-patch.json.\Windows-Security-Audit.ps1 -Modules cmmc,nist,stig,cisa -OutputFormat All.\Windows-Security-Audit.ps1 -Modules gdpr,enisa,iso27001 -OutputFormat HTMLAny module can run directly without the orchestrator:
# Run CIS module standalone
.\modules\module-cis.ps1
# Filter results inline
.\modules\module-stig.ps1 | Where-Object { $_.Status -eq 'Fail' -and $_.Severity -in 'Critical','High' }
# Group by category
.\modules\module-nist.ps1 | Group-Object Category | Format-Table Name,Count
# Export single-module results
.\modules\module-acsc.ps1 | Export-Csv .\acsc-quick.csv -NoTypeInformationUseful for:
- Quick targeted testing during module development
- CI/CD pipelines testing specific compliance requirements
- Embedding individual checks in larger automation
$action = New-ScheduledTaskAction `
-Execute 'powershell.exe' `
-Argument '-NoProfile -ExecutionPolicy Bypass -File "C:\WinSecAudit\Windows-Security-Audit.ps1" -OutputFormat All -OutputPath "C:\WinSecAudit\reports\daily" -Quiet'
$trigger = New-ScheduledTaskTrigger -Daily -At 3am
Register-ScheduledTask `
-TaskName "Windows Security Audit Daily" `
-Action $action `
-Trigger $trigger `
-RunLevel Highest `
-User "SYSTEM"# On each system
.\Windows-Security-Audit.ps1 -OutputFormat JSON -OutputPath ".\$env:COMPUTERNAME-baseline.json"
# Centrally aggregate
$results = @{}
Get-ChildItem .\baselines\*.json | ForEach-Object {
$results[$_.BaseName] = Get-Content $_.FullName | ConvertFrom-Json
}.\Windows-Security-Audit.ps1 -JsonLog -LogFile C:\Splunk\inputs\winsec-audit.jsonSplunk forwarder config (inputs.conf):
[monitor://C:\Splunk\inputs\winsec-audit.json]
disabled = false
sourcetype = winsec_audit_json
index = security- Start with
coremodule for baseline assessment - Run as Administrator for full results
- Review HTML report carefully before remediation
- Capture a baseline JSON for future comparison
- Always test in non-production first
- Use
-Parallel -Workers 8for faster execution on multi-core systems - Schedule regular audits (daily/weekly)
- Preserve baselines for trend analysis
- Use
-RollbackPathwhenever applying remediations - Monitor for compliance drift via
-Baselinecomparisons
- Generate both HTML (human review) and JSON (automation) outputs
- Archive reports with timestamps in version control
- Use cross-framework correlations to demonstrate single-system multi-standard compliance
- Capture system info (hostname, OS version, patch level) alongside reports
- Always start with interactive mode (
-RemediateIssues_Fail) to understand changes - Use
-RollbackPathfor every auto-remediation run - Test rollback scripts before relying on them
- Apply bundles only after reviewing their full impact
- Document remediations in change management systems
- Enable parallel execution:
-Parallel -Workers 8 - Keep cache enabled (default; never use
-NoCachein production) - For repeated audits, the cache warming dominates total time — use
-ShowProfileto identify slow modules - Use
-Modulesto scope audits when full coverage isn't needed
See also:
- USAGE_GUIDE.md (top-level) — extended usage walkthrough
- Quick Start Guide — 5-minute setup
- Module Documentation — per-module details
- Output Reference — full output schema
- Architecture and Design — internal architecture
- Troubleshooting Guide — problem resolution
Windows Security Audit Project · Version 6.1.2 · MIT License
Repository · Releases · Issues · Pull Requests
Changelog · Contributing · Security Policy · License
Frameworks: ACSC · CIS · CISA · CMMC · Core · ENISA · GDPR · HIPAA · ISO 27001 · MS · MS-DefenderATP · NIST · NSA · PCI-DSS · SOC 2 · STIG
Coverage: 16 Modules · 3,994 Automated Security Checks · 5 Native Output Formats · 6 Browser-based Exports · Zero External Dependencies
This documentation reflects Windows Security Audit Project v6.1.2 released 2026-04-25. For older versions, see the release tags.
Page last updated: 2026-04-25
Version 6.1.2 · 16 modules · 3,994 checks
Frameworks Covered
ACSC · CIS · CISA · CMMC · Core · ENISA · GDPR · HIPAA · ISO 27001 · MS · MS-DefenderATP · NIST · NSA · PCI-DSS · SOC 2 · STIG
Output Formats
HTML · JSON · CSV · XML · Console · 6 browser exports
Status Values
Pass · Fail · Warning · Info · Error
Severity Levels
Critical · High · Medium · Low · Informational