'one', 'two' | ConvertTo-Html -Property @{ l='Name'; e={ $_ } }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HTML TABLE</title>
</head><body>
<table>
<colgroup><col/></colgroup>
<tr><th>Name</th></tr>
<tr><td>one</td></tr>
<tr><td>two</td></tr>
</table>
</body></html>
This is how it has always worked in Windows PowerShell.
The property name becomes the column header (th), and the values the column data (td).
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HTML TABLE</title>
</head><body>
<table>
<colgroup><col/></colgroup>
<tr><th>Name</th></tr>
<tr><td></td></tr>
<tr><td></td></tr>
</table>
</body></html>
Note how the <td> elements are unexpectedly empty.
PowerShell Core v6.1.0-preview.2 on macOS 10.13.4
PowerShell Core v6.1.0-preview.2 on Ubuntu 16.04.4 LTS
PowerShell Core v6.1.0-preview.2 on Microsoft Windows 10 Pro (64-bit; Version 1709, OS Build: 16299.371)
/cc @SteveL-MSFT Can we consider this as bug?
@iSazonov:
To me the feature is (a) obviously broken in and of itself (I added a bit more detail) and (b) a regression from Windows PowerShell, so let me ask the opposite question: why _wouldn't_ this be a bug?
@mklement0 If it's a regression then it's definitely a bug.
Most helpful comment
@mklement0 If it's a regression then it's definitely a bug.