add: Array list to store the results of the audit

This commit is contained in:
DrIOS
2024-05-26 13:10:06 -05:00
parent d06875700d
commit 5f5b220fd4
2 changed files with 5 additions and 5 deletions

View File

@@ -3,8 +3,8 @@ Import-Module .\output\module\M365FoundationsCISReport\*\*.psd1
.\helpers\psDoc-master\src\psDoc.ps1 -moduleName M365FoundationsCISReport -outputDir ".\" -template ".\helpers\psDoc-master\src\out-markdown-template.ps1" -fileName ".\README.md" .\helpers\psDoc-master\src\psDoc.ps1 -moduleName M365FoundationsCISReport -outputDir ".\" -template ".\helpers\psDoc-master\src\out-markdown-template.ps1" -fileName ".\README.md"
<# #<#
$ver = "v0.1.1" $ver = "v0.1.2"
git checkout main git checkout main
git pull origin main git pull origin main
git tag -a $ver -m "Release version $ver Bugfix Update" git tag -a $ver -m "Release version $ver Bugfix Update"

View File

@@ -209,7 +209,7 @@ function Invoke-M365SecurityAudit {
} # End Begin } # End Begin
Process { Process {
$allAuditResults = @() # Initialize a collection to hold all results $allAuditResults = [System.Collections.ArrayList]::new() #@() # Initialize a collection to hold all results
# Dynamically dot-source the test scripts # Dynamically dot-source the test scripts
$testsFolderPath = Join-Path -Path $PSScriptRoot -ChildPath "tests" $testsFolderPath = Join-Path -Path $PSScriptRoot -ChildPath "tests"
@@ -242,7 +242,7 @@ function Invoke-M365SecurityAudit {
Write-Host "Running $functionName..." Write-Host "Running $functionName..."
$result = & $functionName @paramList $result = & $functionName @paramList
# Assuming each function returns an array of CISAuditResult or a single CISAuditResult # Assuming each function returns an array of CISAuditResult or a single CISAuditResult
$allAuditResults += $result [void]($allAuditResults.add($Result))
} }
} }
} }
@@ -253,7 +253,7 @@ function Invoke-M365SecurityAudit {
Disconnect-M365Suite Disconnect-M365Suite
} }
# Return all collected audit results # Return all collected audit results
return $allAuditResults return $allAuditResults.ToArray()
# Check if the Disconnect switch is present # Check if the Disconnect switch is present
} }
} }