From 1e106f94ba3542d5a12a2e52afd5d37569e7b88c Mon Sep 17 00:00:00 2001 From: DrIOS <58635327+DrIOSX@users.noreply.github.com> Date: Sun, 30 Jun 2024 12:15:58 -0500 Subject: [PATCH] fix: 8.5.5 simplified output and added object comment --- source/Private/Get-CISMSTeamsOutput.ps1 | 7 ++++++- source/tests/Test-MeetingChatNoAnonymous.ps1 | 15 +++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/source/Private/Get-CISMSTeamsOutput.ps1 b/source/Private/Get-CISMSTeamsOutput.ps1 index db01902..806b0a9 100644 --- a/source/Private/Get-CISMSTeamsOutput.ps1 +++ b/source/Private/Get-CISMSTeamsOutput.ps1 @@ -246,8 +246,13 @@ function Get-CISMSTeamsOutput { # - Condition A: The `MeetingChatEnabledType` setting in Teams is not set to `EnabledExceptAnonymous`. # - Condition B: The setting for meeting chat allows chat for anonymous users. # - Condition C: Verification using the Teams Admin Center indicates that the meeting chat settings are not configured as recommended. - # Retrieve the Teams meeting policy for meeting chat + # $CsTeamsMeetingPolicyChat Mock Object + <# + $CsTeamsMeetingPolicyChat = [PSCustomObject]@{ + MeetingChatEnabledType = "Enabled" + } + #> $CsTeamsMeetingPolicyChat = Get-CsTeamsMeetingPolicy -Identity Global | Select-Object -Property MeetingChatEnabledType return $CsTeamsMeetingPolicyChat } diff --git a/source/tests/Test-MeetingChatNoAnonymous.ps1 b/source/tests/Test-MeetingChatNoAnonymous.ps1 index 64e0e2e..c84a2ea 100644 --- a/source/tests/Test-MeetingChatNoAnonymous.ps1 +++ b/source/tests/Test-MeetingChatNoAnonymous.ps1 @@ -5,14 +5,12 @@ function Test-MeetingChatNoAnonymous { # Aligned # Parameters can be defined here if needed ) - begin { # Dot source the class script if necessary #. .\source\Classes\CISAuditResult.ps1 # Initialization code, if needed $recnum = "8.5.5" } - process { try { # 8.5.5 (L2) Ensure meeting chat does not allow anonymous users @@ -30,22 +28,24 @@ function Test-MeetingChatNoAnonymous { # - Condition A: The `MeetingChatEnabledType` setting in Teams is not set to `EnabledExceptAnonymous`. # - Condition B: The setting for meeting chat allows chat for anonymous users. # - Condition C: Verification using the Teams Admin Center indicates that the meeting chat settings are not configured as recommended. - # Retrieve the Teams meeting policy for meeting chat + # $CsTeamsMeetingPolicyChat Mock Object + <# + $CsTeamsMeetingPolicyChat = [PSCustomObject]@{ + MeetingChatEnabledType = "Enabled" + } + #> $CsTeamsMeetingPolicyChat = Get-CISMSTeamsOutput -Rec $recnum # Condition A: Check if the MeetingChatEnabledType is set to 'EnabledExceptAnonymous' $chatAnonDisabled = $CsTeamsMeetingPolicyChat.MeetingChatEnabledType -eq 'EnabledExceptAnonymous' - # Prepare failure reasons and details based on compliance $failureReasons = if ($chatAnonDisabled) { "N/A" } else { - "Meeting chat allows anonymous users" + "Meeting chat allows anonymous users. User the following command to remediate:`nSet-CsTeamsMeetingPolicy -Identity Global -MeetingChatEnabledType `"EnabledExceptAnonymous`"" } - $details = "MeetingChatEnabledType is set to $($CsTeamsMeetingPolicyChat.MeetingChatEnabledType)" - # Create and populate the CISAuditResult object $params = @{ Rec = $recnum @@ -61,7 +61,6 @@ function Test-MeetingChatNoAnonymous { $auditResult = Get-TestError -LastError $LastError -recnum $recnum } } - end { # Return the audit result return $auditResult