diff --git a/source/tests/Test-CustomerLockbox.ps1 b/source/tests/Test-CustomerLockbox.ps1 index 542ce5c..6060a78 100644 --- a/source/tests/Test-CustomerLockbox.ps1 +++ b/source/tests/Test-CustomerLockbox.ps1 @@ -1,19 +1,39 @@ function Test-CustomerLockbox { [CmdletBinding()] param ( - # Define your parameters here + # Aligned + # Define your parameters here if needed ) begin { + # Dot source the class script if necessary - $auditResults = @() + # Initialization code, if needed } process { # 1.3.6 (L2) Ensure the customer lockbox feature is enabled + + # Retrieve the organization configuration $orgConfig = Get-OrganizationConfig | Select-Object CustomerLockBoxEnabled $customerLockboxEnabled = $orgConfig.CustomerLockBoxEnabled + # Prepare failure reasons and details based on compliance + $failureReasons = if (-not $customerLockboxEnabled) { + "Customer lockbox feature is not enabled." + } + else { + "N/A" + } + + $details = if ($customerLockboxEnabled) { + "Customer Lockbox Enabled: True" + } + else { + "Customer Lockbox Enabled: False" + } + + # Create and populate the CISAuditResult object $auditResult = [CISAuditResult]::new() $auditResult.Status = if ($customerLockboxEnabled) { "Pass" } else { "Fail" } $auditResult.ELevel = "E5" @@ -21,20 +41,18 @@ function Test-CustomerLockbox { $auditResult.Rec = "1.3.6" $auditResult.RecDescription = "Ensure the customer lockbox feature is enabled" $auditResult.CISControlVer = 'v8' - $auditResult.CISControl = "0.0" # As per the snapshot provided, this is explicitly not mapped + $auditResult.CISControl = "0.0" # As per the snapshot provided, this is explicitly not mapped $auditResult.CISDescription = "Explicitly Not Mapped" $auditResult.IG1 = $false $auditResult.IG2 = $false $auditResult.IG3 = $false $auditResult.Result = $customerLockboxEnabled - $auditResult.Details = "Customer Lockbox Enabled: $customerLockboxEnabled" - $auditResult.FailureReason = if ($customerLockboxEnabled) { "N/A" } else { "Customer lockbox feature is not enabled." } - - $auditResults += $auditResult + $auditResult.Details = $details + $auditResult.FailureReason = $failureReasons } end { - # Return auditResults - return $auditResults + # Return the audit result + return $auditResult } }