title: Powershell - help converting hash table to HTML
body: <p>I have followed an example of creating a hash table and converting it into HTML </p>
  
  <pre><code>http://stackoverflow.com/questions/19455435/converting-hashtable-in-powershell
  </code></pre>
  
  <p>Here is my example based on this OP's answer:</p>
  
  <pre><code>$Summary = @{
  Computers=$ADServerCount.count
  DMZ=$TotalDMZ.count
  No_Ping=$TotalNoPing.count
  Reg_Failed=$TotalRegFailed.count
  RebootPending=$TotalPendingReboot.count
  RebootNotRequired=$TotalNoPatchRequired.count 
  }
  
  [PSCustomObject]$Summary | Convertto-HTML -fragment
  </code></pre>
  
  <p>...and here is the result if I were to just run $Summary - just what I expected:</p>
  
  <pre><code>Name                           Value                                             
  ----                           -----                                             
  RebootNotRequired              69                                                
  DMZ                            10                                                
  Computers                      341                                               
  Reg_Failed                                                                       
  RebootPending                  137                                               
  No_Ping                        80 
  </code></pre>
  
  <p>However, if I try to convert to HTML, by running [PSCustomObject]$Summary | Convertto-HTML -fragment, I get this without the values from above:</p>
  
  <pre><code>&lt;table&gt;
  &lt;colgroup&gt;
  &lt;col/&gt;
  &lt;col/&gt;
  &lt;col/&gt;
  &lt;col/&gt;
  &lt;col/&gt;
  &lt;col/&gt;
  &lt;col/&gt;
  &lt;/colgroup&gt;
  &lt;tr&gt;&lt;th&gt;IsReadOnly&lt;/th&gt;&lt;th&gt;IsFixedSize&lt;/th&gt;&lt;th&gt;IsSynchronized&lt;/th&gt;&lt;th&gt;Keys&lt;/th&gt;
  &lt;th&gt;Values&lt;/th&gt;&lt;th&gt;SyncRoot&lt;/th&gt;&lt;th&gt;Count&lt;/th&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;False&lt;/td&gt;&lt;td&gt;False&lt;/td&gt;&lt;td&gt;False&lt;/td&gt;&lt;td&gt;System.Collections.Hashtable+
  KeyCollection&lt;/td&gt;&lt;td&gt;System.Collections.Hashtable+ValueCollection&lt;/td&gt;&lt;td&gt;Syst
  em.Object&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Please help. Thanks</p>
  
  <p>Here is more of the code - as you can see, there are two further variables that can be converted into an HTML table, $GroupPendingRebootbyOwner and $OlderThan30Days, but the $Summary returns gobbledygook. I have truncated the rest of the code that emails out.</p>
  
  <pre><code>$Summary = @{
  Computers=$ADServerCount.count
  DMZ=$TotalDMZ.count
  No_Ping=$TotalNoPing.count
  Reg_Failed=$TotalRegFailed.count
  RebootPending=$TotalPendingReboot.count
  RebootNotRequired=$TotalNoPatchRequired.count 
  } 
  
  $ExecSummary = [PSCustomObject]$Summary | Convertto-HTML -fragment
  
  $GroupPendingRebootbyOwner = $AllTeamsFilter | Select Computer, RebootPending, Owner | Where {$_.Rebootpending -match 'True'} | 
  Select Computer, Owner | Group Owner | Sort Count -desc | Select Name, Count | Convertto-HTML -fragment
  
  $OlderThan30Days = $AllTeamsFilter | Select Computer, RebootPending, Owner, DaysAgo | 
  Where {$_.RebootPending -match 'True' -and $_.DaysAgo -notmatch 'No_Ping' -and $_.DaysAgo -notmatch 'DMZ' -and $_.DaysAgo -notmatch 'Reg_Failed' -and $_.DaysAgo -gt '31'} | 
  Select Computer, Owner, DaysAgo | Sort DaysAgo -desc | Convertto-HTML -fragment
  
  $Mailto = "emailaddress"
  $EmailFrom = "emailaddress"
  $SMTPServer = "smtpserver"
  $HTMLmessage = @"
  &lt;font color=""black"" face=""Arial"" size=""3""&gt;
  &lt;h1 style='font-family:arial;'&gt;&lt;b&gt;Windows Updates and Pending Reboot Report&lt;/b&gt;&lt;/h1&gt;
  &lt;style type=""text/css""&gt;body{font: .8em ""Lucida Grande"", Tahoma, Arial, Helvetica, sans-serif;}
  ol{margin:0 auto;}
  table{width:auto;}
  thead{}
  thead th{font-size:120%;text-align:left;}
  th{border-bottom:2px solid rgb(79,129,189);border-top:2px solid rgb(79,129,189);padding-bottom:10px;padding-top:10px;}
  tr{padding:10px 10px 10px 10px;border:none;}
  #middle{background-color:#900;}
  &lt;/style&gt;
  &lt;body BGCOLOR=""white""&gt;
  &lt;p style='font: ""Lucida Grande"", Tahoma, Arial, Helvetica, sans-serif;'&gt;&lt;b&gt;Executive Summary&lt;/b&gt;&lt;br&gt;
  $ExecSummary
  &lt;p style='font: ""Lucida Grande"", Tahoma, Arial, Helvetica, sans-serif;'&gt;&lt;b&gt;Pending Reboots by owner ("blank" name = unassigned owner)&lt;/b&gt;&lt;br&gt;
  $GroupPendingRebootbyOwner
  &lt;p style='font: ""Lucida Grande"", Tahoma, Arial, Helvetica, sans-serif;'&gt;&lt;b&gt;Last rebooted more than 30 days ago&lt;/b&gt;&lt;br&gt;
  $OlderThan30Days
  &lt;/body&gt;
  "@
  </code></pre>