here it is
$report = @()
foreach ($dc in get-datacenter) {
foreach ($cluster in get-cluster -Location $dc){
$vms = get-vm -Location $cluster | ? { $_.powerstate -eq "PoweredOn" -and $_.extensiondata.guest.toolsstatus -ne "toolsok"}
foreach ($vm in $vms){
$vmview = get-vm -Name $vm -Location $cluster | Get-View
$info = "" | select Name, Datacenter, Cluster, Toolsstatus, guestos, vcenter
$info.Name = $vm.name
$info.datacenter = $dc.name
$info.cluster = $cluster.name
$info.toolsstatus = $vmview.guest.toolsstatus
$info.guestos = $vmview.guest.guestfullname
$info.vcenter = $vm | select @{N="vcenter";E={$Uid.Split(":")[0].Split("@")[1]}}
$report += $info
}}}
$report | export-csv "c:\scripts\oldvmtools.csv" -notypeInformation