Both of these tables are generated by taking the output of “Get-VM” and displaying different information.

Notes about this code:

Once again - I use raw HTML to set the color of the table headers.

Again - I run the output of these commands through Select-Object with the use of the “Expression” option to set column labels appropriately.

Again - I use ConvertTo-HTML –Fragment to get a nice HTML table outputted.

This time I do something different to get color coding for individual entries in the table. I actually set each table cell to be “red” by default. I then do some string parsing to see if the health is good – and switch the background color if I get a positive result. The reason why I use this approach is that the list of “known good states” is much smaller than the list of “known bad states”.