Book Image

Learning PowerCLI for VMware VSphere

By : Robert van den Nieuwendijk
Book Image

Learning PowerCLI for VMware VSphere

By: Robert van den Nieuwendijk

Overview of this book

Table of Contents (17 chapters)
Learning PowerCLI
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using esxcli from PowerCLI


VMware offers more command-line interfaces for vSphere than PowerCLI. One of them is the vSphere Command-Line Interface (vSphere CLI). The vSphere CLI has a command called esxcli. PowerCLI has built-in support for this esxcli command in the Get-EsxCli cmdlet.

Note

There are no New-EsxCli, Set-EsxCli, and Remove EsxCli cmdlets. The Get-EsxCli cmdlet exposes the esxcli functionality for a host. You cannot create a new one, modify, or remove it.

The syntax of the Get-EsxCli cmdlet is:

Get-EsxCli -VMHost <VMHost[]> [[-Server] <VIServer[]>] [<CommonParameters>]

Use the Get-EsxCli cmdlet to connect to the esxcli functionality of a host and save the connection in a variable $esxcli:

PowerCLI C:\> $esxcli = Get-EsxCli -VMHost 192.168.0.133

In the vSphere CLI, the command to get information about the CPUs in your host is:

C:\>esxcli --server=192.168.0.133 hardware cpu list
Enter username: root
Enter password:

In PowerCLI, the command becomes a little...