6.5

Table Of Contents
You can use vmware-cmd options to retrieve a number of dierent virtual machine aributes. For a complete
list of options, see the vSphere CLI Reference.
n
The guestinfo option allows you to retrieve information about the guest operating system. For
example, you can retrieve the number of remote consoles allowed by a virtual machine by using
guestinfo with the RemoteDisplay.maxConnections variable.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost
<esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx getguestinfo RemoteDisplay.maxConnections
The Hardening Guide includes additional information about variables you can use in conjunction with
guestinfo. A complete list is not available.
n
The getuptime option retrieves the uptime of the guest operating system on the virtual machine, in
seconds.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost
<esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx getuptime
getuptime() = 17921
n
The getproductinfo product option lists the VMware product that the virtual machine runs on.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost
<esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx getproductinfo product
The return value can be esx for VMware ESX, embeddedESX for VMware ESXi, or unknown.
n
The getproductinfo platform option lists the platform that the virtual machine runs on.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost
<esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx getproductinfo platform
The return value can be win32-x86 for an x86-based Windows system, linux-x86 for an x86-based Linux
system, or vmnix-x86 for an x86-based ESXi microkernel.
n
The getproductinfo build, getproductinfo majorversion, or getproductinfo minorversion options
retrieve version information.
n
The getstate option retrieves the execution state of the virtual machine, which can be on, off,
suspended, or unknown.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost
<esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx getstate
getstate() = on
n
The gettoolslastactive option indicates whether VMware Tools is installed and whether the guest
operating system is responding normally.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost
<esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx gettoolslastactive
The command returns an integer indicating how much time has passed, in seconds, since the last
heartbeat was detected from the VMware Tools service. This value is initialized to zero when a virtual
machine powers on. The value stays at zero until the rst heartbeat is detected. After the rst heartbeat,
the value is always greater than zero until the virtual machine is power cycled again. The command
returns one of the following values.
n
0 – VMware Tools is not installed or not running.
n
1 – Guest operating system is responding normally.
n
5 – Intermient heartbeat. There might be a problem with the guest operating system.
vSphere Command-Line Interface Concepts and Examples
126 VMware, Inc.