From b336f73eda5c5dcbac722651cfc0430a23f67cd6 Mon Sep 17 00:00:00 2001 From: Przemyslaw Klys Date: Mon, 12 Sep 2022 22:16:20 +0200 Subject: [PATCH] Fixes SplitReports --- Public/Invoke-GPOZaurr.ps1 | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/Public/Invoke-GPOZaurr.ps1 b/Public/Invoke-GPOZaurr.ps1 index 5ac93e0..1597f02 100644 --- a/Public/Invoke-GPOZaurr.ps1 +++ b/Public/Invoke-GPOZaurr.ps1 @@ -187,24 +187,32 @@ Write-Color -Text '[i]', '[End ] ', $($Script:GPOConfiguration[$T]['Name']), " [Time to execute: $TimeEndGPOList]" -Color Yellow, DarkGray, Yellow, DarkGray if ($SplitReports) { + $TimeLogHTML = Start-TimeLog New-HTMLReportWithSplit -FilePath $FilePath -Online:$Online -HideHTML:$HideHTML -CurrentReport $T + $TimeLogEndHTML = Stop-TimeLog -Time $TimeLogHTML -Option OneLiner + Write-Color -Text '[i]', '[HTML ] ', 'Generating HTML report', " [Time to execute: $TimeLogEndHTML]" -Color Yellow, DarkGray, Yellow, DarkGray } } } - # Generate pretty HTML - $TimeLogHTML = Start-TimeLog - if (-not $FilePath) { - $FilePath = Get-FileName -Extension 'html' -Temporary - } - if ($Type.Count -gt 1 -and -not $SplitReports) { - New-HTMLReportWithSplit -FilePath $FilePath -Online:$Online -HideHTML:$HideHTML - } else { - New-HTMLReportAll -FilePath $FilePath -Online:$Online -HideHTML:$HideHTML -Type $Type - } + if ( -not $SplitReports) { + # Generate pretty HTML + $TimeLogHTML = Start-TimeLog + if (-not $FilePath) { + $FilePath = Get-FileName -Extension 'html' -Temporary + } - $TimeLogEndHTML = Stop-TimeLog -Time $TimeLogHTML -Option OneLiner - Write-Color -Text '[i]', '[HTML ] ', 'Generating HTML report', " [Time to execute: $TimeLogEndHTML]" -Color Yellow, DarkGray, Yellow, DarkGray + # Split reports are handled above so we skip if this was set + if ($Type.Count -gt 1) { + New-HTMLReportWithSplit -FilePath $FilePath -Online:$Online -HideHTML:$HideHTML + } else { + New-HTMLReportAll -FilePath $FilePath -Online:$Online -HideHTML:$HideHTML -Type $Type + } + + + $TimeLogEndHTML = Stop-TimeLog -Time $TimeLogHTML -Option OneLiner + Write-Color -Text '[i]', '[HTML ] ', 'Generating HTML report', " [Time to execute: $TimeLogEndHTML]" -Color Yellow, DarkGray, Yellow, DarkGray + } if ($PassThru) { $Script:Reporting }