Create HTML reports

by May 25, 2010

ConvertTo-HTML will convert text information into simple HTML, which can then be saved to disk. These reports will work fine, even though they are pretty ugly. Using just a simple HTML style sheet, your HTML reports will look a lot better:

$style = @'
body { background-color:#EEEEEE; }
body,table,td,th { font-family:Tahoma; color:Black; Font-Size:10pt }
th { font-weight:bold; background-color:#AAAAAA; }
td { background-color:white; }

Get-Process |
ConvertTo-HTML Name, Company, CPU -head $style |
Out-File $home\report.htm
ii "$home\report.htm"

Twitter This Tip! ReTweet this Tip!