Fix: 6.1.2/3 csv output when no test was run
This commit is contained in:
@@ -103,7 +103,12 @@ function Export-M365SecurityAuditTable {
|
|||||||
switch ($test) {
|
switch ($test) {
|
||||||
"6.1.2" {
|
"6.1.2" {
|
||||||
$details = $auditResult.Details
|
$details = $auditResult.Details
|
||||||
|
if ($details -ne "No M365 E3 licenses found.") {
|
||||||
$csv = $details | ConvertFrom-Csv -Delimiter '|'
|
$csv = $details | ConvertFrom-Csv -Delimiter '|'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$csv = $null
|
||||||
|
}
|
||||||
|
|
||||||
if ($null -ne $csv) {
|
if ($null -ne $csv) {
|
||||||
foreach ($row in $csv) {
|
foreach ($row in $csv) {
|
||||||
@@ -120,7 +125,12 @@ function Export-M365SecurityAuditTable {
|
|||||||
}
|
}
|
||||||
"6.1.3" {
|
"6.1.3" {
|
||||||
$details = $auditResult.Details
|
$details = $auditResult.Details
|
||||||
|
if ($details -ne "No M365 E5 licenses found.") {
|
||||||
$csv = $details | ConvertFrom-Csv -Delimiter '|'
|
$csv = $details | ConvertFrom-Csv -Delimiter '|'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$csv = $null
|
||||||
|
}
|
||||||
|
|
||||||
if ($null -ne $csv) {
|
if ($null -ne $csv) {
|
||||||
foreach ($row in $csv) {
|
foreach ($row in $csv) {
|
||||||
@@ -155,11 +165,13 @@ function Export-M365SecurityAuditTable {
|
|||||||
Write-Information "No results found for test number $($result.TestNumber)." -InformationAction Continue
|
Write-Information "No results found for test number $($result.TestNumber)." -InformationAction Continue
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (($result.Details -ne "No M365 E3 licenses found.") -and ($result.Details -ne "No M365 E5 licenses found.")) {
|
||||||
$result.Details | Export-Csv -Path $fileName -NoTypeInformation
|
$result.Details | Export-Csv -Path $fileName -NoTypeInformation
|
||||||
$exportedTests += $result.TestNumber
|
$exportedTests += $result.TestNumber
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ($exportedTests.Count -gt 0) {
|
if ($exportedTests.Count -gt 0) {
|
||||||
Write-Information "The following tests were exported: $($exportedTests -join ', ')" -InformationAction Continue
|
Write-Information "The following tests were exported: $($exportedTests -join ', ')" -InformationAction Continue
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user