r/PowerShell • u/MadBoyEvo • Mar 16 '21
Script Sharing Advanced HTML reporting in PowerShell
Today I've spent some time and wrote a blog post about new features of PSWriteHTML. While it says in the title Advanced HTML reporting it's actually advanced in terms of what you can achieve, but not complicated to use.
Here's Search via Alphabet

Search using Search Builder

Sorting dates

Condtional formatting based on dates, numbers, strings with complicated logic

And future features - maps :-D

All this doable often with 1-5 lines of code. For example
Get-Process | Select-Object -First 5 | Out-HtmlView -SearchBuilder -Filtering {
New-TableCondition -Name 'PriorityClass' -Value 'Normal' -HighlightHeaders Name,Id -BackgroundColor Red
}There are also heavy improvements in terms of performance where you're now able to store 50k-100k records in a single HTML file and still have responsive HTML.
187
Upvotes
1
u/poshftw Mar 20 '21
I mean what it is really should be
-ShowHTML, because by default cmdlets shouldn't show/do anything interactively without being explicitly asked to. Because when it's running in the script in the batch job - there is noone to interact with.