From 357f284d0820f17117e6b7372eaca3e150561bb1 Mon Sep 17 00:00:00 2001 From: DrIOS <58635327+DrIOSX@users.noreply.github.com> Date: Sun, 4 Aug 2024 13:49:58 -0500 Subject: [PATCH] add: test number to error --- source/tests/Test-AntiPhishingPolicy.ps1 | 2 +- source/tests/Test-MailboxAuditingE3.ps1 | 2 +- source/tests/Test-MailboxAuditingE5.ps1 | 2 +- source/tests/Test-SafeAttachmentsPolicy.ps1 | 2 +- source/tests/Test-SafeAttachmentsTeams.ps1 | 2 +- source/tests/Test-SafeLinksOfficeApps.ps1 | 2 +- source/tests/Test-SpamPolicyAdminNotify.ps1 | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/tests/Test-AntiPhishingPolicy.ps1 b/source/tests/Test-AntiPhishingPolicy.ps1 index 61901c6..135a667 100644 --- a/source/tests/Test-AntiPhishingPolicy.ps1 +++ b/source/tests/Test-AntiPhishingPolicy.ps1 @@ -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 } } diff --git a/source/tests/Test-MailboxAuditingE3.ps1 b/source/tests/Test-MailboxAuditingE3.ps1 index 1e78179..d95968b 100644 --- a/source/tests/Test-MailboxAuditingE3.ps1 +++ b/source/tests/Test-MailboxAuditingE3.ps1 @@ -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" } diff --git a/source/tests/Test-MailboxAuditingE5.ps1 b/source/tests/Test-MailboxAuditingE5.ps1 index 75c6d5e..7dfbe81 100644 --- a/source/tests/Test-MailboxAuditingE5.ps1 +++ b/source/tests/Test-MailboxAuditingE5.ps1 @@ -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" } diff --git a/source/tests/Test-SafeAttachmentsPolicy.ps1 b/source/tests/Test-SafeAttachmentsPolicy.ps1 index dda59f0..b6c257c 100644 --- a/source/tests/Test-SafeAttachmentsPolicy.ps1 +++ b/source/tests/Test-SafeAttachmentsPolicy.ps1 @@ -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" } diff --git a/source/tests/Test-SafeAttachmentsTeams.ps1 b/source/tests/Test-SafeAttachmentsTeams.ps1 index b9f29b9..d931347 100644 --- a/source/tests/Test-SafeAttachmentsTeams.ps1 +++ b/source/tests/Test-SafeAttachmentsTeams.ps1 @@ -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" } diff --git a/source/tests/Test-SafeLinksOfficeApps.ps1 b/source/tests/Test-SafeLinksOfficeApps.ps1 index d41777f..25433ab 100644 --- a/source/tests/Test-SafeLinksOfficeApps.ps1 +++ b/source/tests/Test-SafeLinksOfficeApps.ps1 @@ -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" } diff --git a/source/tests/Test-SpamPolicyAdminNotify.ps1 b/source/tests/Test-SpamPolicyAdminNotify.ps1 index 194b441..bb5e7d4 100644 --- a/source/tests/Test-SpamPolicyAdminNotify.ps1 +++ b/source/tests/Test-SpamPolicyAdminNotify.ps1 @@ -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 } }