From 050ea83acd88e4d12a8bfd5c4f59953c35920e21 Mon Sep 17 00:00:00 2001 From: DrIOS <58635327+DrIOSX@users.noreply.github.com> Date: Tue, 28 May 2024 14:47:42 -0500 Subject: [PATCH] fix: 2.1.6 aligned with test-template --- source/tests/Test-SpamPolicyAdminNotify.ps1 | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/source/tests/Test-SpamPolicyAdminNotify.ps1 b/source/tests/Test-SpamPolicyAdminNotify.ps1 index ebe2d81..4e822ec 100644 --- a/source/tests/Test-SpamPolicyAdminNotify.ps1 +++ b/source/tests/Test-SpamPolicyAdminNotify.ps1 @@ -1,16 +1,20 @@ function Test-SpamPolicyAdminNotify { [CmdletBinding()] param ( + # Aligned # Parameters can be added if needed ) begin { + # Dot source the class script if necessary + #. .\source\Classes\CISAuditResult.ps1 + # Initialization code, if needed - $auditResults = @() + $auditResult = [CISAuditResult]::new() } process { - # 2.1.6 Ensure Exchange Online Spam Policies are set to notify administrators + # 2.1.6 Ensure Exchange Online Spam Policies are set to notify administrators # Get the default hosted outbound spam filter policy $hostedOutboundSpamFilterPolicy = Get-HostedOutboundSpamFilterPolicy | Where-Object { $_.IsDefault -eq $true } @@ -30,7 +34,6 @@ function Test-SpamPolicyAdminNotify { } # Create an instance of CISAuditResult and populate it - $auditResult = [CISAuditResult]::new() $auditResult.Status = if ($areSettingsEnabled) { "Pass" } else { "Fail" } $auditResult.ELevel = "E3" $auditResult.ProfileLevel = "L1" @@ -45,14 +48,10 @@ function Test-SpamPolicyAdminNotify { $auditResult.Result = $areSettingsEnabled $auditResult.Details = if ($areSettingsEnabled) { "Both BccSuspiciousOutboundMail and NotifyOutboundSpam are enabled." } else { $failureDetails -join ' ' } $auditResult.FailureReason = if (-not $areSettingsEnabled) { "One or both spam policies are not set to notify administrators." } else { "N/A" } - - $auditResults += $auditResult } end { - # Return auditResults - return $auditResults + # Return auditResult + return $auditResult } } - -