My previous script is using the [pscustomobject] typecast which is a PowerShell 3.0 feature. You are probably using PowerShell 2.0. I modified the script using the New-Object cmdlet, to make it PowerShell 2.0 compatible.
$vm = Get-VM
# VM’s with snapshot
$vms = $vm |
Where-Object {$_ | Get-Snapshot} |
Select-Object -ExpandProperty Name
if ($vms) {$vms = [string]::Join(',', $vms)}
New-Object -TypeName PSObject -Property @{
"VM Attribute" = "VM’s with snapshot"
"VM Name" = $vms
}
# VM’s with tools outdate
$vms = $vm |
Where-Object {$_.ExtensionData.Summary.Guest.ToolsStatus -ne 'OK'} |
Select-Object -ExpandProperty Name
if ($vms) {$vms = [string]::Join(',', $vms)}
New-Object -TypeName PSObject -Property @{
"VM Attribute" = "VM’s with tools outdate"
"VM Name" = $vms
}