This PowerShell script collects detailed inventory and performance metrics from a VMware vCenter environment. It gathers provisoning information about virtual machines, host systems, and their utilization percentages over a specified period, then exports the data to an Excel workbook.
- PowerCLI module installed
- ImportExcel PowerShell module installed
- Access to vCenter Server
- Appropriate permissions to query VM and host statistics
- Collects host information including CPU, memory, and processor details
- Gathers VM specifications including CPU, memory, and storage allocation
- Captures performance metrics with different sampling intervals based on historical depth:
- Last 2 days: 5-minute intervals
- 2-7 days: 30-minute intervals
- 8-30 days: 2-hour intervals
- Beyond 30 days: Daily intervals
- Exports data to Excel with multiple worksheets:
- Physical Provisioning
- Virtual Provisioning
- Asset Ownership
- Utilization
- Run the script in PowerShell
- Enter the requested information when prompted:
- vCenter IP address
- Username
- Password
- Number of collection days
The script generates an Excel file named "VMWARE_Inventory_And_Usage_Workbook_YYYY-MM-DD.xlsx" containing:
- Detailed host information
- VM configurations
- Resource utilization metrics
- Asset ownership details
- VMware Customer Experience Improvement Program (CEIP) is disabled
- Only powered-on VMs are included in the collection by default
- Performance metrics include CPU and memory usage (peak and average values)
- Hostname
- CPU count
- Memory capacity
- Processor type
- Server name
- Operating system
- CPU allocation
- Memory allocation
- Storage capacity
- Host assignment
- CPU peak and average usage
- Memory peak and average consumption