add: test number to error

This commit is contained in:
DrIOS
2024-08-04 13:49:58 -05:00
parent 9e3058add4
commit 357f284d08
7 changed files with 7 additions and 7 deletions

View File

@@ -215,7 +215,7 @@ function Test-AntiPhishingPolicy {
$auditResult = Initialize-CISAuditResult @params
}
catch {
Write-Error "An error occurred during the test: $_"
Write-Error "An error occurred during the test $recnum`:: $_"
$auditResult = Get-TestError -LastError $_ -recnum $recnum
}
}

View File

@@ -101,7 +101,7 @@ function Test-MailboxAuditingE3 {
$auditResult = Initialize-CISAuditResult @params
}
catch {
Write-Error "An error occurred during the test: $_"
Write-Error "An error occurred during the test $recnum`:: $_"
# Retrieve the description from the test definitions
$testDefinition = $script:TestDefinitionsObject | Where-Object { $_.Rec -eq $recnum }
$description = if ($testDefinition) { $testDefinition.RecDescription } else { "Description not found" }

View File

@@ -103,7 +103,7 @@ function Test-MailboxAuditingE5 {
$auditResult = Initialize-CISAuditResult @params
}
catch {
Write-Error "An error occurred during the test: $_"
Write-Error "An error occurred during the test $recnum`:: $_"
# Retrieve the description from the test definitions
$testDefinition = $script:TestDefinitionsObject | Where-Object { $_.Rec -eq $recnum }
$description = if ($testDefinition) { $testDefinition.RecDescription } else { "Description not found" }

View File

@@ -90,7 +90,7 @@ function Test-SafeAttachmentsPolicy {
$auditResult = Initialize-CISAuditResult @params
}
catch {
Write-Error "An error occurred during the test: $_"
Write-Error "An error occurred during the test $recnum`:: $_"
# Retrieve the description from the test definitions
$testDefinition = $script:TestDefinitionsObject | Where-Object { $_.Rec -eq $recnum }
$description = if ($testDefinition) { $testDefinition.RecDescription } else { "Description not found" }

View File

@@ -88,7 +88,7 @@ AllowSafeDocsOpen: $($_.AllowSafeDocsOpen)
$auditResult = Initialize-CISAuditResult @params
}
catch {
Write-Error "An error occurred during the test: $_"
Write-Error "An error occurred during the test $recnum`:: $_"
# Retrieve the description from the test definitions
$testDefinition = $script:TestDefinitionsObject | Where-Object { $_.Rec -eq $recnum }
$description = if ($testDefinition) { $testDefinition.RecDescription } else { "Description not found" }

View File

@@ -58,7 +58,7 @@ function Test-SafeLinksOfficeApps {
$auditResult = Initialize-CISAuditResult @params
}
catch {
Write-Error "An error occurred during the test: $_"
Write-Error "An error occurred during the test $recnum`:: $_"
# Retrieve the description from the test definitions
$testDefinition = $script:TestDefinitionsObject | Where-Object { $_.Rec -eq $recnum }
$description = if ($testDefinition) { $testDefinition.RecDescription } else { "Description not found" }

View File

@@ -108,7 +108,7 @@ function Test-SpamPolicyAdminNotify {
$auditResult = Initialize-CISAuditResult @params
}
catch {
Write-Error "An error occurred during the test: $_"
Write-Error "An error occurred during the test $recnum`:: $_"
$auditResult = Get-TestError -LastError $_ -recnum $recnum
}
}