easy way to do it would be to create an empty array, dump the results into that array... pipe the array into convertto-html
yup, just realized that's the easiest....here is the modified code:
########################
# Port Groups Security #
########################
$pgsec = @()
foreach ($vmhost in get-vmhost){
$hostview = Get-View $vmhost.ID
$portgroups = $hostview.Config.network.portgroup
foreach ($portgroup in $portgroups)
{
$row = "" | select @{Name="Host"; Expression={$vmhost.Name}},
@{Name="PortGroup Name"; Expression={$portgroup.spec.Name}},
@{Name="VSwitch Name"; Expression={$portgroup.spec.vswitchname}},
@{Name="Accept Promiscuous Mode"; Expression={$portgroup.computedpolicy.security.allowpromiscuous}},
@{Name="Accept Mac Changes"; Expression={$portgroup.computedpolicy.security.MacChanges}},
@{Name="Accept Forged Transmits"; Expression={$portgroup.computedpolicy.security.ForgedTransmits}}
$pgsec += $row
}
}
$pgsec | ConvertTo-Html | Out-File test.htm