fix: 8.5.5 aligned with test-template
This commit is contained in:
@@ -1,25 +1,36 @@
|
|||||||
function Test-MeetingChatNoAnonymous {
|
function Test-MeetingChatNoAnonymous {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
# Aligned
|
||||||
# Parameters can be defined here if needed
|
# Parameters can be defined here if needed
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
# Dot source the class script
|
# Dot source the class script if necessary
|
||||||
|
#. .\source\Classes\CISAuditResult.ps1
|
||||||
$auditResults = @()
|
# Initialization code, if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
# 8.5.5 (L2) Ensure meeting chat does not allow anonymous users
|
# 8.5.5 (L2) Ensure meeting chat does not allow anonymous users
|
||||||
# Name doesn't match profile level in benchmarks either.
|
|
||||||
|
|
||||||
# Connect to Teams PowerShell using Connect-MicrosoftTeams
|
# Connect to Teams PowerShell using Connect-MicrosoftTeams
|
||||||
|
|
||||||
|
# Retrieve the Teams meeting policy for meeting chat
|
||||||
$CsTeamsMeetingPolicyChat = Get-CsTeamsMeetingPolicy -Identity Global | Select-Object -Property MeetingChatEnabledType
|
$CsTeamsMeetingPolicyChat = Get-CsTeamsMeetingPolicy -Identity Global | Select-Object -Property MeetingChatEnabledType
|
||||||
$chatAnonDisabled = $CsTeamsMeetingPolicyChat.MeetingChatEnabledType -eq 'EnabledExceptAnonymous'
|
$chatAnonDisabled = $CsTeamsMeetingPolicyChat.MeetingChatEnabledType -eq 'EnabledExceptAnonymous'
|
||||||
|
|
||||||
# Create an instance of CISAuditResult and populate it
|
# Prepare failure reasons and details based on compliance
|
||||||
|
$failureReasons = if ($chatAnonDisabled) {
|
||||||
|
"N/A"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
"Meeting chat allows anonymous users"
|
||||||
|
}
|
||||||
|
|
||||||
|
$details = "MeetingChatEnabledType is set to $($CsTeamsMeetingPolicyChat.MeetingChatEnabledType)"
|
||||||
|
|
||||||
|
# Create and populate the CISAuditResult object
|
||||||
$auditResult = [CISAuditResult]::new()
|
$auditResult = [CISAuditResult]::new()
|
||||||
$auditResult.CISControlVer = "v8"
|
$auditResult.CISControlVer = "v8"
|
||||||
$auditResult.CISControl = "0.0" # Explicitly Not Mapped as per the image provided
|
$auditResult.CISControl = "0.0" # Explicitly Not Mapped as per the image provided
|
||||||
@@ -32,15 +43,13 @@ function Test-MeetingChatNoAnonymous {
|
|||||||
$auditResult.IG3 = $false # Set based on the CIS Controls image
|
$auditResult.IG3 = $false # Set based on the CIS Controls image
|
||||||
$auditResult.RecDescription = "Ensure meeting chat does not allow anonymous users"
|
$auditResult.RecDescription = "Ensure meeting chat does not allow anonymous users"
|
||||||
$auditResult.Result = $chatAnonDisabled
|
$auditResult.Result = $chatAnonDisabled
|
||||||
$auditResult.Details = "MeetingChatEnabledType is set to $($CsTeamsMeetingPolicyChat.MeetingChatEnabledType)"
|
$auditResult.Details = $details
|
||||||
$auditResult.FailureReason = if ($chatAnonDisabled) { "N/A" } else { "Meeting chat allows anonymous users" }
|
$auditResult.FailureReason = $failureReasons
|
||||||
$auditResult.Status = if ($chatAnonDisabled) { "Pass" } else { "Fail" }
|
$auditResult.Status = if ($chatAnonDisabled) { "Pass" } else { "Fail" }
|
||||||
|
|
||||||
$auditResults += $auditResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
end {
|
end {
|
||||||
# Return auditResults
|
# Return the audit result
|
||||||
return $auditResults
|
return $auditResult
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user