fix: 8.5.2 aligned with test-template

This commit is contained in:
DrIOS
2024-05-28 11:23:55 -05:00
parent c122174cb7
commit 36cb3f1944

View File

@@ -1,13 +1,14 @@
function Test-NoAnonymousMeetingStart { function Test-NoAnonymousMeetingStart {
[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 {
@@ -18,7 +19,17 @@ function Test-NoAnonymousMeetingStart {
$CsTeamsMeetingPolicyAnonymous = Get-CsTeamsMeetingPolicy -Identity Global | Select-Object -Property AllowAnonymousUsersToStartMeeting $CsTeamsMeetingPolicyAnonymous = Get-CsTeamsMeetingPolicy -Identity Global | Select-Object -Property AllowAnonymousUsersToStartMeeting
$anonymousStartDisabled = -not $CsTeamsMeetingPolicyAnonymous.AllowAnonymousUsersToStartMeeting $anonymousStartDisabled = -not $CsTeamsMeetingPolicyAnonymous.AllowAnonymousUsersToStartMeeting
# Create an instance of CISAuditResult and populate it # Prepare failure reasons and details based on compliance
$failureReasons = if ($anonymousStartDisabled) {
"N/A"
}
else {
"Anonymous users and dial-in callers can start a meeting"
}
$details = "AllowAnonymousUsersToStartMeeting is set to $($CsTeamsMeetingPolicyAnonymous.AllowAnonymousUsersToStartMeeting)"
# 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
@@ -31,15 +42,13 @@ function Test-NoAnonymousMeetingStart {
$auditResult.IG3 = $false # Set based on the CIS Controls image $auditResult.IG3 = $false # Set based on the CIS Controls image
$auditResult.RecDescription = "Ensure anonymous users and dial-in callers can't start a meeting" $auditResult.RecDescription = "Ensure anonymous users and dial-in callers can't start a meeting"
$auditResult.Result = $anonymousStartDisabled $auditResult.Result = $anonymousStartDisabled
$auditResult.Details = "AllowAnonymousUsersToStartMeeting is set to $($CsTeamsMeetingPolicyAnonymous.AllowAnonymousUsersToStartMeeting)" $auditResult.Details = $details
$auditResult.FailureReason = if ($anonymousStartDisabled) { "N/A" } else { "Anonymous users and dial-in callers can start a meeting" } $auditResult.FailureReason = $failureReasons
$auditResult.Status = if ($anonymousStartDisabled) { "Pass" } else { "Fail" } $auditResult.Status = if ($anonymousStartDisabled) { "Pass" } else { "Fail" }
$auditResults += $auditResult
} }
end { end {
# Return auditResults # Return the audit result
return $auditResults return $auditResult
} }
} }