A comprehensive Windows security auditing and threat detection toolkit. Features 58 production-ready PowerShell functions organized into 14 modules for enterprise-grade security assessment, compliance validation, and incident response.
PowerShell
v1.6.2 #5: rename Test-PCI-DSS -> Test-PciDssCompliance (hyphenated function name triggered the 'restricted characters' import warning); Test-PCI-DSS kept as backward-compatible alias
Okan YILDIZfac4aa51832b
diff --git a/Compliance/Get-ComplianceReport.ps1 b/Compliance/Get-ComplianceReport.ps1index 8e93452..d3c72e2 100644--- a/Compliance/Get-ComplianceReport.ps1+++ b/Compliance/Get-ComplianceReport.ps1@@ -149,7 +149,7 @@ function Get-ComplianceReport {Write-Host "`n[3/3] Running PCI-DSS compliance test..." -ForegroundColor Cyantry {- $pciResult = Test-PCI-DSS -Version '4.0'+ $pciResult = Test-PciDssCompliance -Version '4.0'$frameworkSummary = [PSCustomObject]@{Framework = 'PCI-DSS v4.0'diff --git a/Compliance/Test-PCI-DSS.ps1 b/Compliance/Test-PciDssCompliance.ps1similarity index 99%rename from Compliance/Test-PCI-DSS.ps1rename to Compliance/Test-PciDssCompliance.ps1index 3c0874e..d1b825b 100644--- a/Compliance/Test-PCI-DSS.ps1+++ b/Compliance/Test-PciDssCompliance.ps1@@ -1,4 +1,4 @@-function Test-PCI-DSS {+function Test-PciDssCompliance {<#.SYNOPSISTests system compliance against PCI-DSS requirements@@ -10,10 +10,12 @@.PARAMETER RequirementFilterSpecific requirement to test: All, Network, Data, AccessControl, Monitoring, Testing.EXAMPLE- Test-PCI-DSS- Test-PCI-DSS -Version '4.0' -RequirementFilter Network+ Test-PciDssCompliance+ Test-PciDssCompliance -Version '4.0' -RequirementFilter Network.OUTPUTSPSCustomObject with PCI-DSS compliance results+ .NOTES+ Test-PCI-DSS is kept as a backward-compatible alias.#>[CmdletBinding()]diff --git a/Enterprise/Invoke-SecurityAssessment.ps1 b/Enterprise/Invoke-SecurityAssessment.ps1index 373e24e..bcd623d 100644--- a/Enterprise/Invoke-SecurityAssessment.ps1+++ b/Enterprise/Invoke-SecurityAssessment.ps1@@ -983,7 +983,7 @@ try {# PCI-DSS Compliance (v4.0)try {Write-Host " Running PCI-DSS Compliance (v4.0)..." -ForegroundColor Yellow- $pciResult = Test-PCI-DSS -Version '4.0'+ $pciResult = Test-PciDssCompliance -Version '4.0'if ($null -ne $pciResult) {$pciPercentage = $nullif ($pciResult.PSObject.Properties['Summary'] -and $null -ne $pciResult.Summary) {diff --git a/README.md b/README.mdindex edc49be..25c8ff3 100644--- a/README.md+++ b/README.md@@ -1,4 +1,4 @@-# 🛡️ Windows Security Audit PowerShell Module+# 🛡️ Windows Security Audit PowerShell Module<div align="center">@@ -203,7 +203,7 @@ WindowsSecurityAudit/│ ├── Get-ComplianceReport.ps1│ ├── Test-CISBenchmark.ps1│ ├── Test-NISTCompliance.ps1-│ └── Test-PCI-DSS.ps1+│ └── Test-PciDssCompliance.ps1│├── 📁 Core/ # Core Security (5 functions)│ ├── Compare-SecurityBaseline.ps1@@ -629,10 +629,12 @@ The Compliance module automates security framework validation and generates audi|----------|---------|---------------------|------------------|| **`Test-CISBenchmark`** | Validates CIS-style security controls | • CIS-inspired Level 1 (basic) checks<br>• 16 automated checks<br>• Windows 10/11/Server<br>• Text remediation guidance per check (not scripts)<br>• Detailed scoring | Automated pass/fail results<br>Evidence collection || **`Test-NISTCompliance`** | Assesses selected NIST 800-53 controls | • 17 controls across 5 families<br>• Access Control (AC)<br>• Audit & Accountability (AU)<br>• Identification & Authentication (IA)<br>• System & Communications Protection (SC)<br>• Configuration Management (CM) | Control validation<br>Gap analysis<br>Maturity scoring |-| **`Test-PCI-DSS`** | Validates PCI-DSS requirements | • 18 requirement checks (PCI-DSS 4.0)<br>• Network security controls<br>• Access control<br>• Encryption validation<br>• Log monitoring<br>• Vulnerability management | Requirement mapping<br>Evidence generation<br>SAQ support |+| **`Test-PciDssCompliance`** | Validates PCI-DSS requirements | • 18 requirement checks (PCI-DSS 4.0)<br>• Network security controls<br>• Access control<br>• Encryption validation<br>• Log monitoring<br>• Vulnerability management | Requirement mapping<br>Evidence generation<br>SAQ support || **`Get-ComplianceReport`** | Generates comprehensive compliance reports | • Multi-framework dashboard<br>• Executive summaries<br>• Technical evidence<br>• Gap analysis<br>• Remediation roadmap<br>• Trend analysis | Professional reports<br>Audit-ready format<br>Action plans || **`Export-ComplianceEvidence`** | Collects and packages audit evidence | • Configuration exports (secedit, auditpol, firewall rules, registry, gpresult)<br>• Log extraction (event logs, failed logons, PowerShell logs)<br>• Text status captures (Defender/firewall/BitLocker) — not graphical screenshots<br>• System inventory (software, users, groups, services, updates)<br>• Chain of custody documentation<br>• SHA-256 integrity hashing of the configuration exports and the final ZIP bundle | Complete evidence<br>Timestamp verification<br>Integrity hashing |+`Test-PCI-DSS` still works as an alias.+---### 🔟 Active Directory Module (6 Functions)diff --git a/Reporting/Get-SecurityMetrics.ps1 b/Reporting/Get-SecurityMetrics.ps1index 6ae11d7..b2d7be9 100644--- a/Reporting/Get-SecurityMetrics.ps1+++ b/Reporting/Get-SecurityMetrics.ps1@@ -953,10 +953,10 @@ function Get-SecurityMetrics {$failedCollectors += 'Test-NISTCompliance'}- # Test-PCI-DSS+ # Test-PciDssCompliancetry {$totalFunctions++- $pci = Test-PCI-DSS -ErrorAction Stop+ $pci = Test-PciDssCompliance -ErrorAction Stopif ($pci) {# Scoreif ($pci.PSObject.Properties['ComplianceScore']) {@@ -991,8 +991,8 @@ function Get-SecurityMetrics {}} catch {$failedFunctions++- Write-Verbose " Test-PCI-DSS: $_"- $failedCollectors += 'Test-PCI-DSS'+ Write-Verbose " Test-PciDssCompliance: $_"+ $failedCollectors += 'Test-PciDssCompliance'}# Get-ComplianceReportdiff --git a/Reporting/New-SecurityDashboard.ps1 b/Reporting/New-SecurityDashboard.ps1index 9aaafb4..85bdebd 100644--- a/Reporting/New-SecurityDashboard.ps1+++ b/Reporting/New-SecurityDashboard.ps1@@ -523,15 +523,15 @@ function New-SecurityDashboard {}try {- $c = Test-PCI-DSS -ErrorAction Stop+ $c = Test-PciDssCompliance -ErrorAction Stopif (-not $c.PSObject.Properties['ComplianceScore'] -and $c.PSObject.Properties['Summary'] -and $c.Summary) {$c | Add-Member -NotePropertyName ComplianceScore -NotePropertyValue $c.Summary.CompliancePercentage}$script:dashboardData.Compliance.PCIDSS = $c$functionCount++- Write-Host " [21/54] Test-PCI-DSS: $($c.ComplianceScore)%" -ForegroundColor Green+ Write-Host " [21/54] Test-PciDssCompliance: $($c.ComplianceScore)%" -ForegroundColor Green} catch {- Write-Warning " Test-PCI-DSS failed: $_"+ Write-Warning " Test-PciDssCompliance failed: $_"$script:dashboardData.Compliance.PCIDSS = @{ ComplianceScore = $null; Status = "Error" }}diff --git a/WindowsSecurityAudit.psd1 b/WindowsSecurityAudit.psd1index ac8b2d0..94f1138 100644--- a/WindowsSecurityAudit.psd1+++ b/WindowsSecurityAudit.psd1@@ -78,13 +78,13 @@'Test-M365SecurityPosture','Test-NISTCompliance','Test-PatchCompliance',- 'Test-PCI-DSS',+ 'Test-PciDssCompliance','Test-SystemIntegrity','Update-DefenderConfiguration')CmdletsToExport = @()VariablesToExport = @()- AliasesToExport = @()+ AliasesToExport = @('Test-PCI-DSS')PrivateData = @{PSData = @{Tags = @('Security', 'Audit', 'DFIR', 'ThreatHunting', 'Compliance', 'MITRE', 'IncidentResponse', 'Vulnerability', 'Windows', 'BlueTeam')diff --git a/WindowsSecurityAudit.psm1 b/WindowsSecurityAudit.psm1index 55feb28..f0874cd 100644--- a/WindowsSecurityAudit.psm1+++ b/WindowsSecurityAudit.psm1@@ -54,7 +54,14 @@ foreach ($import in @($Public + $Private)) {}# Export only the public functions that loaded successfully-Export-ModuleMember -Function $script:LoadedPublic.BaseName+# Backward-compatible alias for the pre-1.6.2 name. A hyphenated FUNCTION name+# triggers the 'restricted characters' import warning; an alias does not.+$aliasesToExport = @()+if (@($script:LoadedPublic.BaseName) -contains 'Test-PciDssCompliance') {+ Set-Alias -Name 'Test-PCI-DSS' -Value 'Test-PciDssCompliance' -Scope Script+ $aliasesToExport += 'Test-PCI-DSS'+}+Export-ModuleMember -Function $script:LoadedPublic.BaseName -Alias $aliasesToExportif ($script:FailedImports.Count -gt 0) {$failedNames = $script:FailedImports.FullName -join ', 'diff --git a/tests/Locale.Regression.Tests.ps1 b/tests/Locale.Regression.Tests.ps1index f6b0b99..3aa6719 100644--- a/tests/Locale.Regression.Tests.ps1+++ b/tests/Locale.Regression.Tests.ps1@@ -94,7 +94,7 @@ BeforeAll {$script:EnFixture = Join-Path -Path $script:FixturePath -ChildPath 'auditpol-backup-en.csv'$script:DeFixture = Join-Path -Path $script:FixturePath -ChildPath 'auditpol-backup-de.csv'- Import-Module -Name $script:ModulePath -Force -DisableNameChecking+ Import-Module -Name $script:ModulePath -Force# Invocation-context guard for 'net accounts' reads (leading = | ; { ( & or# line start). Hardening/Set-SecurityBaseline.ps1 is allowed (legit /set writes).diff --git a/tests/Smoke.Windows.Tests.ps1 b/tests/Smoke.Windows.Tests.ps1index d27c667..0206382 100644--- a/tests/Smoke.Windows.Tests.ps1+++ b/tests/Smoke.Windows.Tests.ps1@@ -177,12 +177,16 @@ Describe 'WindowsSecurityAudit real-Windows smoke tests' -Tag @('Smoke', 'WindowAssert-ResultShape -Object $result -Names @('TestDate', 'ComputerName', 'NISTRevision', 'ControlFamily', 'Controls', 'Summary', 'Recommendations')}- It 'Test-PCI-DSS -Version 4.0 returns requirements and summary' {- $result = Test-PCI-DSS -Version '4.0'+ It 'Test-PciDssCompliance -Version 4.0 returns requirements and summary' {+ $result = Test-PciDssCompliance -Version '4.0'Assert-ResultShape -Object $result -Names @('TestDate', 'ComputerName', 'PCIDSSVersion', 'RequirementFilter', 'Requirements', 'Summary', 'Recommendations')$result.PCIDSSVersion | Should -Be '4.0'}+ It 'Test-PCI-DSS works as a backward-compatible alias' {+ (Get-Command Test-PCI-DSS).CommandType | Should -Be 'Alias'+ }+# -------------------------------------------------------------- AnalysisIt 'Get-EventLogAnalysis -Hours 1 returns the analysis object' {$result = Get-EventLogAnalysis -Hours 1diff --git a/tests/WindowsSecurityAudit.Tests.ps1 b/tests/WindowsSecurityAudit.Tests.ps1index cae04b9..a00ba64 100644--- a/tests/WindowsSecurityAudit.Tests.ps1+++ b/tests/WindowsSecurityAudit.Tests.ps1@@ -68,7 +68,7 @@ BeforeAll {})- Import-Module -Name $script:ModulePath -Force -DisableNameChecking+ Import-Module -Name $script:ModulePath -Force$script:ExportedFunctions = @(Get-Command -Module $script:ModuleName -CommandType Function)function Get-ScriptFileAst {@@ -86,10 +86,16 @@ AfterAll {Describe 'Module import and exported functions' {It 'imports without throwing' {- { Import-Module -Name $script:ModulePath -Force -DisableNameChecking -ErrorAction Stop } |+ { Import-Module -Name $script:ModulePath -Force -ErrorAction Stop } |Should -Not -Throw}+ It 'imports without the restricted-characters warning' {+ $warnings = @()+ Import-Module $script:ModulePath -Force -WarningVariable +warnings -WarningAction SilentlyContinue+ @($warnings | Where-Object { "$_" -match 'restricted characters' }).Count | Should -Be 0+ }+It 'exports one function per .ps1 file in the category folders' {# Expected count is derived from the files on disk, never hardcoded$script:ExportedFunctions.Count | Should -Be $script:FunctionFiles.Count