Create HTML reports

Share |

Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Powershell Plus

13 Free SQL Tools from Idera

Free Ebook: Mastering Powershell

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!

Posted May 25 2010, 08:00 AM by ps1


jbruns wrote re: Create HTML reports
on 05-26-2010 9:51 AM

Any chance of publishing the 2 HTML code samples in a text file?

The carriage return line feeds are being dropped and the email examples are coming through as a graphic image.


Copyright 2012 All rights reserved.