Hi Luc
would you know by any chance what is the proper way to get to the notes inside the VMhost (not vm's) ?
i need to use get-view to get some additional properties, but cant seem to find the proper way to
query the notes of the ESX itself
if i query get-vmhost |select customfields, they are there, but they dont show up under the view
any ideas ?
Thanks
Martin
$ESXInfo = ForEach ($Datacenter in (Get-Datacenter | Sort-Object -Property Name)) {
ForEach ($Cluster in ($Datacenter | Get-Cluster | Sort-Object -Property Name)) {
ForEach ($ESX in ($Cluster | Get-VMHost |Sort Name |Get-View )) {
$ESX | Select @{N="DEVICE_NAME";E={$ESX.name}},
@{N="DEVICE_STATE";E={$_.Summary.Runtime.PowerState}},
@{N="DEVICE_MANUFACTURER";E={$_.Hardware.SystemInfo.Vendor}},
@{N="DEVICE_MODEL";E={$_.Hardware.SystemInfo.Model}},
@{N="DEVICE_VERSION";E={$_.Config.Product.Version}},
@{N=“DEVICE_CPU_COUNT“;E={$_.Hardware.CpuInfo.NumCpuPackages}},
@{N=“DEVICE_CPU_MEM_GB“;E={“” + (([math]::round($_.Hardware.MemorySize / 1GB, 0))* 1024/1024)}},
@{N="DEVICE_CPU_PROVISIONED_DISK";E={}},
@{N=“DEVICE_IP“;E={($_.Config.Network.Vnic | ? {$_.Device -eq "vmk0"}).Spec.Ip.IpAddress}},
@{N=“DEVICE_OS“;E={$_.Config.Product.Name + $_.Config.Product.Version + “ - Build “ + $_.Config.Product.Build}},
@{N="DEVICE_NOTES_TEST";E={$ESX.value.Notes}},
@{N="DEVICE_NOTES_2";E={$ESX.CustomFields.Item("Notes")}}
}
}
}
$ESXInfo | Export-Csv -NoTypeInformation -UseCulture -Path "D:\temp\vmhost.csv"