EvotecIT / PSWinReporting

This PowerShell Module has multiple functionalities, but one of the signature features of this module is the ability to parse Security logs on Domain Controllers providing easy to use access to AD Events.
MIT License
707 stars 70 forks source link

Charts are broken after running Find-Events #70

Closed ClarkRSD closed 2 years ago

ClarkRSD commented 2 years ago

Pretty straight forward. Run any sort of report with Find-Events.

$Reports = @(
    'ADUserChanges'
    'ADUserChangesDetailed'
    'ADUserStatus'
    'ADUserLockouts'
    #ADUserLogon
    'ADUserUnlocked'
)

$Events = Find-Events -Report $Reports -DateFrom ((Get-Date).AddHours(-24)) -DateTo (Get-Date) -Servers "Server01","Server02" -Verbose

After running your report, attempt to create any chart. Only tested bars and lines, but they're both affected.

New-HTML -Name 'Charts - Bar' -FilePath C:\Temp\DashboardChartsBar00.html {
    New-HTMLPanel {
        New-HTMLChart {
            New-ChartLegend -Name 'Time'
            New-ChartBar -Name 'Test' -Value 1
            New-ChartBar -Name 'Test1' -Value 2
            New-ChartBar -Name 'Test2' -Value 3
        }
    }
} -ShowHTML
New-HTML -Name 'Chart' -FilePath C:\Temp\DashboardChartsBar00.html -ShowHTML {
    New-HTMLChart -Title 'Incidents Reported vs Solved' -TitleAlignment center {
        New-ChartAxisX -Names 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep'
        New-ChartLine -Name 'Incidents per month' -Value 10, 41, 35, 51, 49, 62, 69, 91, 148
        New-ChartLine -Name 'Incidents per month resolved' -Value 5, 10, 20, 31, 49, 62, 69, 91, 148
    }
}

Page doesn't render, simply blank. The only way to resolve is to restart console session and start over. Sorry if this is known, I couldn't find anything on this.

ClarkRSD commented 2 years ago

Also forgot to mention, if this is a problem with PSWriteHTML, I'd be glad to make an issue thread there instead.

PrzemyslawKlys commented 2 years ago

It was a problem with PSWriteHTML. The $Events variable would leak into private scopes and overwrite the private variable. New, updated pswritehtml is out.