This script below works great for the little I need but I cannot figure out how to add what ESX host the vm is running on or the description. Thanks in advance for the help.
*
Connect-VIServer -Server vchost
*
$Report = @()
*
get-vm | % {
*
$vm = Get-View $_.ID
$ReportRow = "" | Select-Object VMName, Hostname, OS, VMState, ToolsStatus, ToolsVersion
$ReportRow.VMName = $vm.Name
$ReportRow.HostName = $vm.guest.hostname
$ReportRow.OS = $vm.guest.guestFullName
$ReportRow.VMState = $vm.summary.runtime.powerState
#$ReportRow.TotalCPU = $vm.summary.config.numcpu
#$ReportRow.TotalMemory = $vm.summary.config.memorysizemb
#$ReportRow.MemoryUsage = $vm.summary.quickStats.guestMemoryUsage
#$ReportRow.TotalNics = $vm.summary.config.numEthernetCards
$ReportRow.ToolsStatus = $vm.guest.toolsstatus
$ReportRow.ToolsVersion = $vm.config.tools.toolsversion
#$ReportRow.MemoryLimit = $vm.resourceconfig.memoryallocation.limit
#$ReportRow.MemoryReservation = $vm.resourceconfig.memoryallocation.reservation
$Report += $ReportRow
}
$Report | Export-CSV c:\export.csv
$_.Host.Name get you the host on which the vm is running on.
Connect-VIServer -Server vchost $Report = @() Get-VM | % { $vm = Get-View $_.ID $ReportRow = "" | Select-Object VMName, Hostname, OS, VMState, ToolsStatus, ToolsVersion $ReportRow.VMName = $vm.Name $ReportRow.HostName = $_.Host.Name $ReportRow.OS = $vm.guest.guestFullName # $ReportRow.IPAddress = $vm.guest.ipAddress $ReportRow.VMState = $vm.summary.runtime.powerState #$ReportRow.TotalCPU = $vm.summary.config.numcpu #$ReportRow.TotalMemory = $vm.summary.config.memorysizemb #$ReportRow.MemoryUsage = $vm.summary.quickStats.guestMemoryUsage #$ReportRow.TotalNics = $vm.summary.config.numEthernetCards $ReportRow.ToolsStatus = $vm.guest.toolsstatus $ReportRow.ToolsVersion = $vm.config.tools.toolsversion #$ReportRow.MemoryLimit = $vm.resourceconfig.memoryallocation.limit #$ReportRow.MemoryReservation = $vm.resourceconfig.memoryallocation.reservation $Report += $ReportRow } $Report | Export-CSV c:\export.csv
basically, you get the vm in a variable and see its props
$vm = get-VM <MyVm> $vm.Host.Name $vm | FL *