EvotecIT/PSWinReporting

Charts are broken after running Find-Events

ClarkRSD opened this issue · 2 comments

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.

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

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