title: Outputting powershell variable as HTML table
body: <p>I have a variable in powershell that is comprised of 19 foreach iterations of a list. Each iteration has 5 variables that I want to split up into 3 columns. I want to view it in a html table. If I just output it in text file all the information is there, but when I try to use ConvertTo-Html it either gets corrupted or lost. What am I doing wrong? </p>
  
  <pre><code>convertto-html $currentLog -fragment | out-file file.txt
  </code></pre>
  
  <p>Gives me:</p>
  
  <pre><code>&lt;table&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Whereas </p>
  
  <pre><code>$currentLog | out-file file.txt
  </code></pre>
  
  <p>Gives me:</p>
  
  <pre><code>SHO: Stevens Point, WI, PING TEST: GOOD ( 1 ms), PRIMARY CIRCUIT: N/A ( - ms)
  MAD: Madison, WI, PING TEST: GOOD ( 8 ms), PRIMARY CIRCUIT: GOOD ( 8 ms)
  DAV: Davenport, IA, PING TEST: GOOD ( 30 ms), PRIMARY CIRCUIT: GOOD ( 31 ms)
  FRE: Freeport, IL, PING TEST: GOOD ( 16 ms), PRIMARY CIRCUIT: GOOD ( 16 ms)
  GOL: Goldsboro, NC, PING TEST: GOOD ( 71 ms), PRIMARY CIRCUIT: GOOD ( 71 ms)
  IRV: Irvine, CA, PING TEST: GOOD ( 73 ms), PRIMARY CIRCUIT: GOOD ( 73 ms)
  MON: Montgomery, AL - Regional Office, PING TEST: GOOD ( 72 ms), PRIMARY CIRCUIT: GOOD ( 72 ms)
  RIC: Richmond, VA, PING TEST: GOOD ( 52 ms), PRIMARY CIRCUIT: GOOD ( 53 ms)
  SAL: Salem, OR, PING TEST: GOOD ( 87 ms), PRIMARY CIRCUIT: GOOD ( 88 ms)
  SCO: Scottsdale, AZ, PING TEST: GOOD ( 95 ms), PRIMARY CIRCUIT: GOOD ( 95 ms)
  WES: Westford, MA, PING TEST: N/A ( - ms), PRIMARY CIRCUIT: GOOD ( 65 ms)
  MIL: Milwaukee, WI - Regional Office, PING TEST: N/A ( - ms), PRIMARY CIRCUIT: GOOD ( 10 ms)
  EDW: Edwardsville, IL, PING TEST: GOOD ( 28 ms), PRIMARY CIRCUIT: GOOD ( 36 ms)
  CHA: Charlotte, NC - Regional Office, PING TEST: N/A ( - ms), PRIMARY CIRCUIT: GOOD ( 47 ms)
  AVI: Stevens Point, WI, PING TEST: FAILED ( N/A ms), PRIMARY CIRCUIT: GOOD ( 1 ms)
  PLO: Plover, WI, PING TEST: N/A ( - ms), PRIMARY CIRCUIT: GOOD ( 1 ms)
  MADG: Madison, WI, PING TEST: N/A ( - ms), PRIMARY CIRCUIT: GOOD ( 7 ms)
  MADC: Madison, WI, PING TEST: N/A ( - ms), PRIMARY CIRCUIT: GOOD ( 7 ms)
  MADR: Madison, WI - Regional Office, PING TEST: N/A ( - ms), PRIMARY CIRCUIT: GOOD ( 8 ms)
  </code></pre>
  
  <p>The code the defines the output of each line in $currentLog is:</p>
  
  <pre><code>$tempLine = "$($testResults.location): $($testResults.city), PING TEST: $($testResults.pingResult) ( $($testResults.pingTime) ms), PRIMARY CIRCUIT: $($testResults.circuitPrimary) ( $($testResults.circuitPrimaryTime) ms)`r`n"
  </code></pre>