This is really, really, really, really, really, simple CSS (Cascading Style Sheets) goofing around.  The point of this is to show what you can do with a few basic style properties and modifiers like :hover, and sneaking it in like a stealthy ninja.

1wearandtear

$OutputFile = "$($env:USERPROFILE)\documents\sample.html"
<# 
it's okay to change the values in the following block
of code, but be careful not to mess with indenting it a lot.
#>
$styles = "<style type=`"text/css`">
body {
  font-family:verdana,sans;
}
table {
  width: 850px;
  display: table;
  border: 1px solid #c1c1c1;
  border-collapse: collapse;
  border-spacing: 2px;
}
th,td {
  font-family:verdana,sans; 
  font-size:10pt;
  padding:5px;
  spacing:4px;
  border: 1px solid #c1c1c1;
}
th {
  background:#66ccff;
}
tr:hover {
  background-color:#eee;
  cursor:pointer;
}
</style>"

<# 
pipe an example WMI class, filtered, into an array which
is then piped into HTML code, and then piped into a file
#>

Get-WmiObject -Class Win32_LogicalDisk |
  Select 'Name','Size','FreeSpace','FileSystem','Description' |
    ConvertTo-Html -Body $_ -Head $Styles -Title "Logical Disks" |
      Out-File -FilePath $OutputFile

# open the HTML file using the default browser...

if (Test-Path $OutputFile) {
  Invoke-Item $OutputFile
}

Mess around with it yourself, but heed the usual boring legal disclaimer stuff:

USE AT YOUR OWN RISK – NEVER USE IN A PRODUCTION ENVIRONMENT UNTIL THOROUGHLY TESTED IN A SAFE ISOLATED ENVIRONMENT – UNLESS YOU OWN THE ENVIRONMENT AND DON’T CARE ABOUT SILLY STUFF, LIKE RISK, OR MONEY.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s