From f5a3f0e460251fbf884786792147f1b8e958fbac Mon Sep 17 00:00:00 2001 From: DrIOS <58635327+DrIOSX@users.noreply.github.com> Date: Tue, 28 May 2024 10:54:52 -0500 Subject: [PATCH] fix: 6.1.2 aligned with test-template --- source/tests/Test-MailboxAuditingE3.ps1 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/tests/Test-MailboxAuditingE3.ps1 b/source/tests/Test-MailboxAuditingE3.ps1 index f37bd65..f9583b4 100644 --- a/source/tests/Test-MailboxAuditingE3.ps1 +++ b/source/tests/Test-MailboxAuditingE3.ps1 @@ -1,15 +1,19 @@ function Test-MailboxAuditingE3 { [CmdletBinding()] param ( + # Aligned # Parameters can be added if needed ) begin { + # Dot source the class script if necessary + #. .\source\Classes\CISAuditResult.ps1 $e3SkuPartNumbers = @("ENTERPRISEPACK", "OFFICESUBSCRIPTION") $AdminActions = @("ApplyRecord", "Copy", "Create", "FolderBind", "HardDelete", "Move", "MoveToDeletedItems", "SendAs", "SendOnBehalf", "SoftDelete", "Update", "UpdateCalendarDelegation", "UpdateFolderPermissions", "UpdateInboxRules") $DelegateActions = @("ApplyRecord", "Create", "FolderBind", "HardDelete", "Move", "MoveToDeletedItems", "SendAs", "SendOnBehalf", "SoftDelete", "Update", "UpdateFolderPermissions", "UpdateInboxRules") $OwnerActions = @("ApplyRecord", "Create", "HardDelete", "MailboxLogin", "Move", "MoveToDeletedItems", "SoftDelete", "Update", "UpdateCalendarDelegation", "UpdateFolderPermissions", "UpdateInboxRules") + $auditResult = [CISAuditResult]::new() $auditResult.ELevel = "E3" $auditResult.ProfileLevel = "L1" @@ -72,10 +76,15 @@ function Test-MailboxAuditingE3 { } } + # Prepare failure reasons and details based on compliance + $failureReasons = if ($allFailures.Count -eq 0) { "N/A" } else { "Audit issues detected." } + $details = if ($allFailures.Count -eq 0) { "All Office E3 users have correct mailbox audit settings." } else { $allFailures -join " | " } + + # Populate the audit result $auditResult.Result = $allFailures.Count -eq 0 $auditResult.Status = if ($auditResult.Result) { "Pass" } else { "Fail" } - $auditResult.Details = if ($auditResult.Result) { "All Office E3 users have correct mailbox audit settings." } else { $allFailures -join " | " } - $auditResult.FailureReason = if (-not $auditResult.Result) { "Audit issues detected." } else { "N/A" } + $auditResult.Details = $details + $auditResult.FailureReason = $failureReasons } end {