From 59278f4a27331148f97f28f040acf81f6ec2d8f0 Mon Sep 17 00:00:00 2001 From: DrIOS <58635327+DrIOSX@users.noreply.github.com> Date: Wed, 26 Jun 2024 08:54:57 -0500 Subject: [PATCH] Fix: Export when tests with nested tables not included. --- source/Public/Export-M365SecurityAuditTable.ps1 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/Public/Export-M365SecurityAuditTable.ps1 b/source/Public/Export-M365SecurityAuditTable.ps1 index 8542ebb..fbe507b 100644 --- a/source/Public/Export-M365SecurityAuditTable.ps1 +++ b/source/Public/Export-M365SecurityAuditTable.ps1 @@ -191,7 +191,7 @@ function Export-M365SecurityAuditTable { } else { if ($ExportOriginalTests) { - Write-Information "No specified tests were included in the export other than the full audit results." -InformationAction Continue + Write-Information "Full audit results exported however, none of the following tests had exports: `n1.1.1, 1.3.1, 6.1.2, 6.1.3, 7.3.4" -InformationAction Continue } else { Write-Information "No specified tests were included in the export." -InformationAction Continue @@ -201,9 +201,12 @@ function Export-M365SecurityAuditTable { if ($ExportOriginalTests) { # Define the test numbers to check $TestNumbersToCheck = "1.1.1", "1.3.1", "6.1.2", "6.1.3", "7.3.4" - - # Check for large details and update the AuditResults array - $updatedAuditResults = Get-ExceededLengthResultDetail -AuditResults $AuditResults -TestNumbersToCheck $TestNumbersToCheck -ExportedTests $exportedTests -DetailsLengthLimit 30000 -PreviewLineCount 25 + if ($exportedTests.Count -gt 0) { + $updatedAuditResults = Get-ExceededLengthResultDetail -AuditResults $AuditResults -TestNumbersToCheck $TestNumbersToCheck -ExportedTests $exportedTests -DetailsLengthLimit 30000 -PreviewLineCount 25 + } + else { + $updatedAuditResults = $auditResults + } $originalFileName = "$ExportPath\$timestamp`_M365FoundationsAudit.csv" if ($ExportToExcel) { $xlsxPath = [System.IO.Path]::ChangeExtension($originalFileName, '.xlsx')