add: aligned test-AuditDisabledFalse
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -15,3 +15,4 @@ output/
|
|||||||
markdownissues.txt
|
markdownissues.txt
|
||||||
node_modules
|
node_modules
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
Aligned.xlsx
|
@@ -5,18 +5,34 @@ function Test-AuditDisabledFalse {
|
|||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
# Dot source the class script
|
# Dot source the class script if necessary
|
||||||
|
|
||||||
$auditResults = @()
|
# Initialization code, if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
# 6.1.1 (L1) Ensure 'AuditDisabled' organizationally is set to 'False'
|
# 6.1.1 (L1) Ensure 'AuditDisabled' organizationally is set to 'False'
|
||||||
# Pass if AuditDisabled is False. Fail otherwise.
|
|
||||||
|
# Retrieve the AuditDisabled configuration
|
||||||
$auditDisabledConfig = Get-OrganizationConfig | Select-Object AuditDisabled
|
$auditDisabledConfig = Get-OrganizationConfig | Select-Object AuditDisabled
|
||||||
$auditNotDisabled = -not $auditDisabledConfig.AuditDisabled
|
$auditNotDisabled = -not $auditDisabledConfig.AuditDisabled
|
||||||
|
|
||||||
# Create an instance of CISAuditResult and populate it
|
# Prepare failure reasons and details based on compliance
|
||||||
|
$failureReasons = if (-not $auditNotDisabled) {
|
||||||
|
"AuditDisabled is set to True"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
"N/A"
|
||||||
|
}
|
||||||
|
|
||||||
|
$details = if ($auditNotDisabled) {
|
||||||
|
"Audit is not disabled organizationally"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
"Audit is disabled organizationally"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create and populate the CISAuditResult object
|
||||||
$auditResult = [CISAuditResult]::new()
|
$auditResult = [CISAuditResult]::new()
|
||||||
$auditResult.Status = if ($auditNotDisabled) { "Pass" } else { "Fail" }
|
$auditResult.Status = if ($auditNotDisabled) { "Pass" } else { "Fail" }
|
||||||
$auditResult.ELevel = "E3"
|
$auditResult.ELevel = "E3"
|
||||||
@@ -30,14 +46,12 @@ function Test-AuditDisabledFalse {
|
|||||||
$auditResult.IG2 = $true
|
$auditResult.IG2 = $true
|
||||||
$auditResult.IG3 = $true
|
$auditResult.IG3 = $true
|
||||||
$auditResult.Result = $auditNotDisabled
|
$auditResult.Result = $auditNotDisabled
|
||||||
$auditResult.Details = if ($auditNotDisabled) { "Audit is not disabled organizationally" } else { "Audit is disabled organizationally" }
|
$auditResult.Details = $details
|
||||||
$auditResult.FailureReason = if (-not $auditNotDisabled) { "AuditDisabled is set to True" } else { "N/A" }
|
$auditResult.FailureReason = $failureReasons
|
||||||
|
|
||||||
$auditResults += $auditResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
end {
|
end {
|
||||||
# Return auditResults
|
# Return the audit result
|
||||||
return $auditResults
|
return $auditResult
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user