Introduction

$timestamp = Get-Date -Format "yyyyMMdd"
Export-Csv -Path "C:ReportsVM_Inventory_$timestamp.csv" -NoTypeInformation


Step 4: Filter by Folder or Cluster

In this article, you will learn how to:

  • Export VM lists by folder, cluster, or globally
  • Include VM name, power state, IP address, OS type, host, and notes
  • Format reports in CSV or HTML
  • Filter exports by tag or state
  • Schedule the export weekly or monthly

Step 1: Connect to vCenter and List All VMs

Get-Cluster -Name "FinanceCluster" | Get-VM | Export-Csv "C:ReportsFinanceCluster_VMs.csv" -NoTypeInformation


Step 5: Filter by Power State or Tag

Powered off only:

Whether you are preparing for an audit, building an inventory system, or handing off documentation, exporting a list of all VMs is one of the most common tasks for any vSphere administrator. PowerCLI allows you to automate this process and include exactly the metadata your team or auditors need.

Connect-VIServer -Server "vcenter.lab.local"
Get-VM


Step 2: Create a Full VM Inventory Report

Get-VM | Select Name, PowerState, VMHost, @{N="IPAddress";E={$_.Guest.IPAddress}}, @{N="OS";E={$_.Guest.OSFullName}}, Notes

Step 3: Export to CSV

Get-VM | Select Name, PowerState, VMHost, @{N="IPAddress";E={$_.Guest.IPAddress}}, @{N="OS";E={$_.Guest.OSFullName}}, Notes | Export-Csv "C:ReportsVM_Inventory.csv" -NoTypeInformation

Include date in the filename:

  • Connects to vCenter
  • Pulls all VMs with size and OS
  • Emails a CSV to the finance or ops team

Bonus: Export to HTML for Browsing or Dashboards

Get-VM | Select Name, PowerState, VMHost, @{N="IPAddress";E={$_.Guest.IPAddress}}, @{N="OS";E={$_.Guest.OSFullName}} | ConvertTo-Html -Title "VM List" | Out-File "C:ReportsVM_List.html"

Troubleshooting

Issue Solution
IP address field is empty Ensure VMware Tools is running inside the guest
OS field shows “Other” or blank The guest OS may be missing or not updated in vCenter
Exported CSV missing expected data Use Select-Object with calculated properties explicitly
Notes field returns blank Verify that annotations are filled in on the VM summary page

Similar Posts