I try to convert a PSObject to a HTML table and get System.Object[]
as output.
$Result = New-Object PSObject
foreach ($Location in $Locations) {
$Servers = GetServers -Location $Location
$Value = @()
foreach ($Server in $Servers) {
if (Test-Path Path) {
$value += $Server #Background of td should be green
} else {
$Value += $Server #Background of td should be red
}
}
$Result | Add-Member -Type NoteProperty -Name $Location -Value $Value
}
$Result ConvertTo-Html
Without converting to HTML the output is:
Location1 : {Server1, Server2} Location2 : {Server3, Server4} Location3 : {Server5, Server6}
Trying to convert:
<td>System.Object[]</td>
And I'd like to have a table like:
Location1 Location2 Location3 --------- --------- --------- Server1 Server3 Server5 Server2 Server4 Server6
If it's possible I would like to have different <td>
background (as commented in the script).
-Value ($Value -join ', ')
– Mathias R. Jessen