There are a couple of elements in that script for which I don't get the purpose, all these Count variables you calculate for example.
I also changed the multiple Get-VM cmdlets to just one.
The following produces the output I think you are after
$vms = Get-VM $OS2008 = $vms | where { $_.guest.OSFullname -match "2008" } | Select @{N="VMname"; E={ $_.name }}, @{ N="Something"; E={ $_.Powerstate } }, @{ N="OS"; E={ $_.guest.OSFullName } } $OS2003 = $vms | where { $_.guest.OSFullname -match "2003" } | Select @{N="VMname"; E={ $_.name }}, @{ N="Something"; E={ $_.Powerstate } }, @{ N="OS"; E={ $_.guest.OSFullName } } $OSXP = $vms | where { $_.guest.OSFullname -match "XP" } | Select @{N="VMname"; E={ $_.name }}, @{ N="Something"; E={ $_.Powerstate } }, @{ N="OS"; E={ $_.guest.OSFullName } } $OSVista = $vms | where { $_.guest.OSFullname -match "Vista" } | Select @{N="VMname"; E={ $_.name }}, @{ N="Something"; E={ $_.Powerstate } }, @{ N="OS"; E={ $_.guest.OSFullName } } $OS7 = $vms | where { $_.guest.OSFullname -match "7" } | Select @{N="VMname"; E={ $_.name }}, @{ N="Something"; E={ $_.Powerstate } }, @{ N="OS"; E={ $_.guest.OSFullName } } $OSLinux = $vms | where { $_.guest.OSFullname -match "Linux" } | Select @{N="VMname"; E={ $_.name }}, @{ N="Something"; E={ $_.Powerstate } }, @{ N="OS"; E={ $_.guest.OSFullName } } $OSOther = $vms | where { $_.guest.OSFullname -notmatch "2008" -and $_.guest.OSFullName -notmatch "XP" -and $_.guest.OSFullName -notmatch "7" -and $_.guest.OSFullName -notmatch "2003" -and $_.guest.OSFullName -notmatch "Linux"}`| Select @{N="VMname"; E={ $_.name }}, @{ N="Something"; E={ $_.Powerstate } }, @{ N="OS"; E={ $_.guest.OSFullName } } $custom = '<style> BODY{background-color:#999966;} TABLE{border-width:1px; border-style:solid; border-color:black; border-collapse:collapse;} TH{border-width:1px; padding:0px; border-style:solid; border-color:black;} TD{border-width:1px; padding:0px; border-style:solid; border-color:black;} </style>' $OS2008 + $OS2003 + $OSXP + $OSVista + $OS7 + $OSLinux + $OSOther | ConvertTo-Html -Head $custom -Body '<H2>OS Count</H2>' | Out-File c:\TestOSCount.htm
Invoke-Item c:\TestOSCount.htm