Introduction
Quick answer: Connect to the intended vCenter, retrieve VMs with Get-VM, select the report columns, and pipe the results to Export-Csv. This guide exports VM name, power state, host, IP addresses, guest OS, and notes. Multiple IP addresses are joined into one readable field instead of an array value. Jump to CSV export or troubleshooting.
Run Steps 1–3 in the same PowerShell session before using the optional examples; they define $vc, $vmProperties, $vmReport, and $reportDirectory. Replace the sample server, folder, cluster, and tag names with your own. Queries use your account’s inventory visibility. Files are written to a Reports subfolder of the current working directory; -NoClobber stops an existing report from being overwritten. If names are repeated across folders or tag categories, narrow the lookup to the intended object first.
- 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
$vc = Connect-VIServer -Server 'vcenter.lab.local'
Get-VM -Server $vc
Step 2: Create a Full VM Inventory Report
$vmProperties = @(
'Name'
'PowerState'
@{Name='VMHost'; Expression={$_.VMHost.Name}}
@{Name='IPAddress'; Expression={$_.Guest.IPAddress -join '; '}}
@{Name='OS'; Expression={$_.Guest.OSFullName}}
'Notes'
)
$vmReport = Get-VM -Server $vc | Select-Object -Property $vmProperties
$vmReport
Step 3: Export to CSV
$reportDirectory = Join-Path (Get-Location) 'Reports'
New-Item -ItemType Directory -Path $reportDirectory -Force | Out-Null
$vmReport | Export-Csv -Path (Join-Path $reportDirectory 'VM_Inventory.csv') -NoTypeInformation -Encoding UTF8 -NoClobber
Include date in the filename:
$timestamp = Get-Date -Format 'yyyyMMdd_HHmmss'
$vmReport | Export-Csv -Path (Join-Path $reportDirectory "VM_Inventory_$timestamp.csv") -NoTypeInformation -Encoding UTF8 -NoClobber
Step 4: Filter by Folder or Cluster
$folder = Get-Folder -Server $vc -Name 'Production'
if (-not $folder) { throw 'Production folder not found; check the selected vCenter and folder name.' }
Get-VM -Server $vc -Location $folder |
Select-Object -Property $vmProperties |
Export-Csv -Path (Join-Path $reportDirectory 'Production_VMs.csv') -NoTypeInformation -Encoding UTF8 -NoClobber
Or by cluster:
$cluster = Get-Cluster -Server $vc -Name 'FinanceCluster'
if (-not $cluster) { throw 'FinanceCluster not found; check the selected vCenter and cluster name.' }
Get-VM -Server $vc -Location $cluster |
Select-Object -Property $vmProperties |
Export-Csv -Path (Join-Path $reportDirectory 'FinanceCluster_VMs.csv') -NoTypeInformation -Encoding UTF8 -NoClobber
Step 5: Filter by Power State or Tag
Powered off only:
Get-VM -Server $vc |
Where-Object {$_.PowerState -eq 'PoweredOff'} |
Select-Object -Property $vmProperties |
Export-Csv -Path (Join-Path $reportDirectory 'PoweredOffVMs.csv') -NoTypeInformation -Encoding UTF8 -NoClobber
By tag (e.g., “BackupEnabled”):
$backupTag = Get-Tag -Server $vc -Name 'BackupEnabled'
if (-not $backupTag) { throw 'BackupEnabled tag not found; check the selected vCenter and tag name.' }
Get-VM -Server $vc -Tag $backupTag |
Select-Object -Property $vmProperties |
Export-Csv -Path (Join-Path $reportDirectory 'TaggedVMs.csv') -NoTypeInformation -Encoding UTF8 -NoClobber
Diagram: VM Export Workflow with PowerCLI

Use Case: Monthly Reporting to Finance or Asset Team
You can create a reusable scheduled task that:
- 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
$vmReport |
ConvertTo-Html -Title 'VM Inventory' |
Out-File -FilePath (Join-Path $reportDirectory 'VM_List.html') -Encoding UTF8 -NoClobber
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 |
| IP addresses show as an array type | Join Guest.IPAddress values into a string before export, as in Step 2. |
| Output file already exists | -NoClobber deliberately stops the export. Choose a new filename or use the timestamped example. |
| Variables are missing or the report is empty | Run Steps 1–3 in order. Verify the selected vCenter, your inventory permissions, and the filter results. |
The inventory queries above read vCenter data; they do not change VM configuration. Exported files may contain internal hostnames, IP addresses, and annotations, so store and share them according to your organization’s data-handling rules. The revised formatting logic was checked with synthetic sample data; validate it against your PowerCLI version and a small inventory scope before scheduling it.
References: Broadcom Get-VM reference and Microsoft Export-Csv documentation.
1 thought on “Export a List of All VMs from vCenter with PowerCLI (Name, Host, IP, OS)”