Useful Remote CLI Commands for ESX Server and VirtualCenter

Author: NetworkAdminKB.com
Created: 2008-12-10
Modified: 2009-01-08

Information:

Here is a list of some general commands to display information about an ESX Host or VirtualCenter.  The examples given all focus on VirtualCenter.  Also not all commands work directly against ESX Hosts, but most work against VirtualCenter.

 

1)      List all Datacenters on a VirtualCenter Server

a.       Vifs.pl --server vc_server --passthroughauth -C

b.      vc_server is the DNS name or IP Address of the VirtualCenter server.

2)      List all Datastores in a specific Datacenter

a.       Vifs.pl --server vc_server --passthroughauth -Z dc_name -S

b.      dc_name is the name of the datacenter and is case sensitive

3)      List all Folders for the specific Datastore and VirtualCenter Server

a.       Vifs.pl --server vc_server --passthroughauth -Z dc_name -D [ds_name]

b.      ds_name is the name of the datastore and is case sensitive

c.       Read Unable to list Folders of Datastores in VIFS.pl Script for more information

4)      List subfolders for top level folders in a Datastore on a VirtualCenter Server

a.       Vifs.pl --server vc_server --passthroughauth -Z dc_name -D [ds_name]/folder

b.      folder is the name of the folder under the datastore, and is case sensitive.

c.       Read Unable to list Folders of Datastores in VIFS.pl Script for more information

 

While not considered part of the Remote CLI the following commands are installed as part of the VI Perl Tool Kit that is installed as part of the Remote CLI installation  These scripts are located in various subfolders of the VMWare Remote CLI installation directory (…\VMware VI Remote CLI\Perl\).

 

You can download the VI Perl Tool Kit and API documentation separately here: http://www.vmware.com/support/developer/viperltoolkit/

 

VI Perl Toolkit command documentation can be found here:

http://www.vmware.com/support/developer/viperltoolkit/viperl16/doc/perl_toolkit_utilities_idx.html

 

1)      List all information about all Virtual Machines in VirtualCenter

a.       vminfo.pl –server vc_server --passthroughauth

b.      vminfo.pl is located in …\VMware VI Remote CLI\Perl\apps\vm

2)      List only the Name of all Virtual Machines in VirtualCenter

a.       vminfo.pl --server vc_server --passthroughauth --fields vmname

b.      vmname is the field name of the value to return, and is not meant to be changed.

c.       Other supported fields

a.       numCpu           guestFullName              hostName             ipAddress

b.      toolsStatus        hostMemoryUsage       memorysize           guestId

c.       virtualdisks       guestMemoryUsage      template                vmPathName

d.      ipAddress         overallCpuUsage          overallStatus

d.      You can provide multiple fields in a comma delimited string (eg: field,field…)

e.       The field names are case sensitive, and can be verified by viewing the Perl script in a text editor.

3)      List all information about Virtual Machines in a Folder on VirtualCenter

a.       vminfo.pl --server vc_server --passthroughauth --folder “folder_name”

b.      folder_name is the name of the Folder in VirtualCenter, and is case sensitive

4)      Display the VirtualCenter hierarchy (Datacenter, Folders, ESX Hosts, Virtual Machines, Resource Pools, etc.)

a.       vidiscovery.pl --server vc_server --passthroughauth --managedentity datacenter --entityname “dc_name”

b.      datacenter is a managed entity keyword and should not be changed.

a.       Other managed entity keywords are: folder, resourcepool and host.

b.      All keywords are case sensitive

c.       dc_name is the name of the datacenter in VirtualCenter, and it is case sensitive.

d.      vidiscovery.pl is located in …\VMware VI Remote CLI\Perl\apps\general

5)      List all Virtual Machines on a specific ESX Host that is managed by VirtualCenter

a.       vidiscovery.pl --server vc_server --passthroughauth --managedentity host --entityname host.fqdn.dns

b.      host is a keyword, and should not be changed.

c.       host.fqdn.dns is the Fully Qualified DNS name that VirtualCenter knows the ESX host as.

6)      Display information about the version of VirtualCenter Server

a.       viversion.pl --server vc_server --passthroughauth

b.      viversion.pl is located in …\VMware VI Remote CLI\Perl\apps\general


How to Install and Configure the Remote CLI.aspx 

Article ID: 120, Created On: 9/17/2011, Modified: 9/17/2011