I have a script that generates a report of the VM tools and hardware using Get-View. I want to add the cluster to the report, if it exists. Best way to do this?
$result= @()
Get-View-ViewTypeVirtualMachine-Property"Name", "Guest.guestfullname",`
"Config.version", "Guest.hostname", "Guest.toolsversion", "guest.toolsversionstatus" |
% {
$row="" | select Name, OS, HWVersion, Host, ToolsVersion, ToolsVersionStatus
$row.Name =$_.Name
$row.OS =$_.guest.guestfullname
$row.HWVersion =$_.config.version
$row.Host =$_.guest.hostname
$row.ToolsVersion =$_.guest.toolsversion
$row.ToolsVersionstatus =$_.guest.toolsversionstatus
$result+=$row
}
$result