Inventory VMware VMs
Documentation: Microsoft Learn
Get-VM against a connected vCenter returns the guests, and the projection keeps the name with PowerState, NumCpu, MemoryGB, and the VMHost the guest is running on.
The script
Script reader
Inspect before you run
Inspect the script below. It does not run in this browser.
Inspection only — no command has run.
Show reference output
Inspect this example’s structure
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Get-VM | Select-Object Name,PowerState,NumCpu,MemoryGB,VMHost- Stage 1Get-VM
Positional values or no named parameters - Stage 2Select-Object
Positional values or no named parameters
How it works
Get-VM against a connected vCenter returns the guests, and the projection keeps the name with PowerState, NumCpu, MemoryGB, and the VMHost the guest is running on. MemoryGB arrives already converted, so no arithmetic is needed in the projection.
Adapting it
Add -Location with a cluster or folder name to scope the query, since a full inventory against a large vCenter takes noticeably longer than most people budget for.
Requirements
VMware PowerCLI with an active Connect-VIServer session.
If the result is unexpected
VMware inventory contains duplicates or misses a vCenter.
The session may have multiple default server connections or connect to the wrong inventory scope.
- List active server connections and query a known VM on an explicit server.
Validate the result
Each VM is associated with its vCenter and inventory identity.
Keep the check reliable
Use explicit server context and retain stable IDs when combining inventories.