From c652b3c88674f058a4f86a3818450759a40d8ea8 Mon Sep 17 00:00:00 2001 From: DrIOS <58635327+DrIOSX@users.noreply.github.com> Date: Fri, 28 Jun 2024 17:32:11 -0500 Subject: [PATCH] fix: 1.2.2 simplified output and added object comment --- source/Private/Get-CISExoOutput.ps1 | 6 +++++- source/tests/Test-BlockSharedMailboxSignIn.ps1 | 7 +++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/source/Private/Get-CISExoOutput.ps1 b/source/Private/Get-CISExoOutput.ps1 index 9f95f1e..59bae99 100644 --- a/source/Private/Get-CISExoOutput.ps1 +++ b/source/Private/Get-CISExoOutput.ps1 @@ -52,7 +52,11 @@ function Get-CISExoOutput { # Test-BlockSharedMailboxSignIn.ps1 $MBX = Get-EXOMailbox -RecipientTypeDetails SharedMailbox # [object[]] - return $MBX + # Example output: + # 123e4567-e89b-12d3-a456-426614174000 + # 987e6543-21ba-12d3-a456-426614174000 + # abcddcba-98fe-76dc-a456-426614174000 + return $MBX.ExternalDirectoryObjectId } '1.3.3' { # Test-ExternalSharingCalendars.ps1 diff --git a/source/tests/Test-BlockSharedMailboxSignIn.ps1 b/source/tests/Test-BlockSharedMailboxSignIn.ps1 index 974e8f4..8d30fd1 100644 --- a/source/tests/Test-BlockSharedMailboxSignIn.ps1 +++ b/source/tests/Test-BlockSharedMailboxSignIn.ps1 @@ -30,8 +30,7 @@ function Test-BlockSharedMailboxSignIn { process { try { # Step: Retrieve shared mailbox details - $MBX = Get-CISExoOutput -Rec $recnum - $objectids = $MBX.ExternalDirectoryObjectId + $objectids = Get-CISExoOutput -Rec $recnum $users = Get-CISAadOutput -Rec $recnum # Step: Retrieve details of shared mailboxes from Azure AD (Condition B: Pass/Fail) $sharedMailboxDetails = $users | Where-Object {$_.objectid -in $objectids} @@ -42,7 +41,7 @@ function Test-BlockSharedMailboxSignIn { # Step: Determine failure reasons based on enabled mailboxes (Condition A & B: Fail) $failureReasons = if (-not $allBlocked) { - "Some mailboxes have sign-in enabled: $($enabledMailboxes -join ', ')" + "Some mailboxes have sign-in enabled (AccountEnabled:True):`n$($enabledMailboxes -join ', ')" } else { "N/A" @@ -53,7 +52,7 @@ function Test-BlockSharedMailboxSignIn { "All shared mailboxes have sign-in blocked." } else { - "Enabled Mailboxes: $($enabledMailboxes -join ', ')" + "AccountEnabled set to True Mailboxes: $($enabledMailboxes -join ', ')" } # Step: Create and populate the CISAuditResult object