I had some spare time on my hands so I decided to add some useful stuff to the VM Reporting powershell script that was posted on this blog. This is what I ended up with, there’s still room for improvement like snapshot information and scsi controller info…
Get-VIServer -Server 192.168.1.1 -User admin -Password admin$Report = @()
get-vm | % {
$vm = Get-View $_.ID
$ReportRow = "" | Select-Object VMName, Hostname, OS, IPAddress, VMState, TotalCPU, TotalMemory, MemoryUsage, TotalNics, ToolsStatus, ToolsVersion, MemoryLimit, MemoryReservation
$ReportRow.VMName = $vm.Name
$ReportRow.HostName = $vm.guest.hostname
$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