Zachary Loeber

The personal website of Zachary Loeber.

Powershell: Colorize-Table.ps1 Updated

A little while ago I released a script which uses custom linq assemblies to quickly modify an html table based on column header and an arbitrary scriptblock to test the values within that entire column (by default it is a simple -eq comparison). If the scriptblock evaluates to be true then you can either change just the cell style or the entire row style.

This allows for extremely fast table rendering on existing html code. If you are clever you can do all kinds of other manipulations with this code but I’ve chosen not to abstract the function any further than basic html table manipulations. I’ve since rounded back on the script after getting some more linq and C# knowledge to make it far more readable and robust. Aside from the base features mentioned I’ve also added the ability to modify even and odd rows. Also, more comments have been added around the “add-type” command and the linq code has been refactored to be somewhat more legible.

You can dot source it into your script then run get-help colorize-table to get more information and examples.

Downloaded the upgraded function at the Microsoft Technet Gallery

comments powered by Disqus