Using PowerCLI in Powershell
From Tech-Wiki
More actions
Use Broadcom VMware PowerCLI to connect to vCenter and export common virtual-machine inventory information.
Validation status
Reviewed against the current VMware PowerCLI command reference on 27 September 2026.
Install PowerCLI
Install PowerCLI
Install-Module VMware.PowerCLI -Scope CurrentUser
Connect securely
$Credential = Get-Credential Connect-VIServer -Server vcenter.example.com -Credential $Credential
Do not make certificate validation Ignore the default
The legacy article configured InvalidCertificateAction Ignore. Prefer a trusted vCenter certificate or an explicitly approved certificate-handling policy rather than silently accepting invalid certificates.
Inventory examples
Get-VM |
Select-Object Name,PowerState,MemoryGB,NumCpu,UsedSpaceGB
Get-VM |
Select-Object Name,PowerState,MemoryGB,NumCpu,UsedSpaceGB |
Export-Csv .\vm-inventory.csv -NoTypeInformation
Disconnect when finished:
Disconnect
Disconnect-VIServer -Server vcenter.example.com -Confirm:$false