Say your boss asks you to plan for expansion and you need to get an inventory of the VMs in your current environment with their resource consumption. What’s the VMware answer for this? Oh buy VCOPs… wait that’s right I don’t have 100k that I can drop right now. Oh there’s a free way to export this to excel? How would I do that?! PowerCLI!
To get an inventory of VMs from your ESXi hosts using PowerCLI:
Get-VM | Export-Csv –path “c:\users\josh\desktop\myVMs.csv” –NoTypeInformation
This will export a CSV file with the following fields:
If you don’t need all of those fields you can select the ones you need with the following syntax:
Get-VM | select Name, Guest, MemoryGB, ProvisionedSpaceGB, UsedSpaceGB | Esxport-CSV –path c:\users\josh\desktop\myVMs.csv –NoTypeInformation
If you don’t type –NoTypeInformation then you will get the following at the beginning of your CSV: #TYPE Selected.Vmware.VimAutomation.ViCore.Impl.V1.Inventory.VirtualMachineImpl