← cd ~/blog
~/blog/vmware-vcenter-vm-inventory-export-to-excel.md

Exporting VMware vCenter VM Inventory to Excel

Exporting VMware vCenter VM Inventory to Excel

vmex is a Go CLI that queries VMware vCenter via the vSphere API and exports filtered VM inventory to formatted Excel workbooks — no PowerCLI required.

If you manage a VMware vSphere environment, you've almost certainly hit the same wall: you need a clean VM inventory for an audit, a capacity review, or a migration project, and vCenter's built-in export gives you a flat CSV with every column whether you want it or not.

That CSV rarely survives contact with a stakeholder. It needs reshaping, filtering, and formatting before it becomes a useful document. By the time you've done that manually twice, writing a tool to automate it starts looking like the sensible option.

vmex (VMware EXporter) queries the vSphere API and exports a filtered, formatted VM inventory directly to an Excel workbook — skipping the CSV intermediate entirely.

What vmex Does

vmex connects to your vCenter instance using the govmomi vSphere SDK, queries the VM inventory with server-side filtering, and writes the result to an .xlsx file using structured column headers. You control which fields are included, which VMs are in scope, and where the file lands.

This replaces the manual export → open in Excel → delete columns → reformat → save cycle with a single command.

Quick Start

# Install
go install github.com/ZeljkoBenovic/vmex@latest

# Basic export — all VMs in the inventory
vmex \
  --host vcenter.corp.example \
  --user [email protected] \
  --password 'YourPassword' \
  --output inventory.xlsx

vmex will connect over HTTPS, enumerate all visible VMs, and write the workbook. The default column set covers the fields most useful for operational reporting:

Filtering the Export

For large environments you rarely want everything. vmex supports filtering by datacenter, cluster, folder, and custom attribute:

# Export only VMs in a specific cluster
vmex \
  --host vcenter.corp.example \
  --user [email protected] \
  --password 'YourPassword' \
  --cluster "Prod-Cluster-01" \
  --output prod-inventory.xlsx

# Export VMs matching a name prefix
vmex \
  --host vcenter.corp.example \
  --user [email protected] \
  --password 'YourPassword' \
  --filter "web-*" \
  --output web-vms.xlsx

Filters are applied server-side via the vSphere API's property collector, which keeps the query efficient on inventories with thousands of VMs.

Handling Self-Signed Certificates

Most internal vCenter deployments use self-signed TLS certificates. Pass --insecure to skip certificate verification:

vmex \
  --host vcenter.corp.example \
  --user [email protected] \
  --password 'YourPassword' \
  --insecure \
  --output inventory.xlsx

For production use, the better option is to import the vCenter CA into your system trust store so --insecure isn't needed.

Using Environment Variables

Credentials in command-line flags show up in shell history. vmex reads from environment variables too:

export VMEX_HOST=vcenter.corp.example
export [email protected]
export VMEX_PASSWORD='YourPassword'

vmex --output inventory.xlsx

This makes it straightforward to wire into CI pipelines or cron jobs without embedding credentials in scripts.

The Excel Output

The workbook uses a clean table format with frozen header rows and auto-sized columns. Numbers (CPU, RAM, disk) are formatted as numbers rather than strings, so Excel's sort and filter functions work correctly out of the box. Power state uses conditional cell colouring — green for powered on, grey for powered off — making it easy to scan a large inventory at a glance.

This is the detail that makes a difference when you're handing the file to someone who will be working with it in Excel rather than grep.

Why Not Just Use PowerCLI?

PowerCLI is the standard tool for vSphere automation and it's excellent. But it requires a Windows machine (or a somewhat painful PowerShell Core setup on Linux), a VMware module install, and you still end up writing the export formatting logic yourself.

vmex is a single static binary with zero runtime dependencies. It runs on Linux, macOS, or Windows, needs no PowerShell, and produces formatted Excel output without any additional steps.

Conclusion

For one-off audits, quarterly capacity reviews, or any reporting workflow that ends in an Excel file, vmex removes the friction between your vCenter inventory and a document someone will actually use.

Browse the vmex source on GitHub and export your next vCenter inventory in seconds.

← prev
Monitoring Veeam B&R with Govein
$ esc
cd ~/ home get blog all posts get projects open-source workloads describe engineer resource spec crash pod CrashLoopBackOff demo get post/easy-mikrotik-backup Mikrotik Backups Made Easy get post/ec2-fleet-commands-without-ssh EC2 Fleet Command Execution Without Opening SSH get post/evm-chain-performance-testing-with-tpser EVM Chain Performance Testing with tpser get post/kubernetes-pvc-snapshot-management-with-kmon Kubernetes Storage Operations Made Easy with kmon get post/teams-direct-routing-without-sbc-hardware Microsoft Teams Direct Routing Without the Hardware SBC get post/veeam-backup-grafana-dashboard Monitoring Veeam B&R with Govein get post/vmware-vcenter-vm-inventory-export-to-excel Exporting VMware vCenter VM Inventory to Excel open job/gombak Go-based automation service for MikroTik router backup management — supports single-device and fleet-wide discovery via L2TP, SSH-based access, configurable retention policies, and system service integration for scheduled unattended backups. open deploy/tsbc Containerised Session Border Controller that bridges SIP/UDP-based PBX systems with Microsoft Teams Direct Routing — orchestrates Kamailio, RTPEngine, and LetsEncrypt TLS to handle signalling and media translation without dedicated SBC hardware. open cronjob/aws-commander CLI tool for fleet-wide remote execution on EC2 instances via AWS SSM Run Command — supports ad-hoc shell commands, script files, and Ansible playbooks, targeting instances by ID or tag without requiring inbound SSH access or open security group rules. open exporter/govein Metrics exporter that queries Veeam Backup & Replication 12+ via its REST API and ships structured job telemetry to InfluxDB 2.0 — ships with a Grafana dashboard template and supports standalone binary, Docker Compose, and Kubernetes Helm deployment. open tool/tpser EVM chain performance testing toolkit with two operating modes — a block-range analyser for historical TPS and gas utilisation reporting, and a sustained load generator for stress-testing nodes at configurable transaction rates over extended durations. open cli/vmex CLI utility that queries VMware vCenter via the vSphere API and exports filtered VM inventory data to formatted Excel workbooks — addressing the limitations of vCenter's native CSV-only export for operational reporting and auditing workflows. open cli/kmon Kubernetes administrative CLI and k9s plugin that automates common storage operations — spins up debug pods from live PVCs, restores volumes from VolumeSnapshots, and generates on-demand or CronJob-scheduled snapshots with configurable snapshot class support.