Introduction to PowerCLI
PowerCLI is a snapin for PowerShell that is intended for use with a VMware environment. It can be found at:
http://communities.vmware.com/community/vmtn/vsphere/automationtools/powercli
Once launched, help can be found using the Get-VICommand commandlet or the Get-PowerCLIHelp commandlet.
To connect to a ESX/ESXi host, use the Connect-VIServer commandlet. An example would be:
Connect-VIServer –Server IP address –Protocol https –User root –Password passwordvalue
Once connected, a message should be displayed:
Once connected to a host, commandlets such as Get-VM and Get-VMHost can be used.
The | format-list option can provide additional details.
More details can be displayed using the | Select-Object * option as well.
The Get-VMGuest commandlet will offer some additional details on a particular VM:
The Get-HardDisk commandlet pulls storage information:
The Get-DataStore commandlet can offer details on items such as free disk space available.
The Disconnect-VIServer commandlet will remove the connection to the host: