From 5f5b220fd4f2dd55786b74b0fa1dce7bb6821c9b Mon Sep 17 00:00:00 2001 From: DrIOS <58635327+DrIOSX@users.noreply.github.com> Date: Sun, 26 May 2024 13:10:06 -0500 Subject: [PATCH] add: Array list to store the results of the audit --- helpers/Build-Help.ps1 | 4 ++-- source/Public/Invoke-M365SecurityAudit.ps1 | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/helpers/Build-Help.ps1 b/helpers/Build-Help.ps1 index a2d483b..60067be 100644 --- a/helpers/Build-Help.ps1 +++ b/helpers/Build-Help.ps1 @@ -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" -<# - $ver = "v0.1.1" +#<# + $ver = "v0.1.2" git checkout main git pull origin main git tag -a $ver -m "Release version $ver Bugfix Update" diff --git a/source/Public/Invoke-M365SecurityAudit.ps1 b/source/Public/Invoke-M365SecurityAudit.ps1 index cff7e59..f2059c0 100644 --- a/source/Public/Invoke-M365SecurityAudit.ps1 +++ b/source/Public/Invoke-M365SecurityAudit.ps1 @@ -209,7 +209,7 @@ function Invoke-M365SecurityAudit { } # End Begin 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 $testsFolderPath = Join-Path -Path $PSScriptRoot -ChildPath "tests" @@ -242,7 +242,7 @@ function Invoke-M365SecurityAudit { Write-Host "Running $functionName..." $result = & $functionName @paramList # 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 } # Return all collected audit results - return $allAuditResults + return $allAuditResults.ToArray() # Check if the Disconnect switch is present } } \ No newline at end of file