vmware-cmd includes options for retrieving information about a virtual machine.
Each option requires that you specify the virtual machine path. See Format for Specifying Virtual Machines. You must also specify connection options, which differ from other vCLI commands. See Connection Options for vmware-cmd.
You can use vmware-cmd options to retrieve a number of different virtual machine attributes. For a complete list of options, see the vSphere CLI Reference.
- 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. - 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
- 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. - 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. - The getproductinfo build,
getproductinfo majorversion
, orgetproductinfo minorversion
options retrieve version information. - 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
- 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 first heartbeat is detected. After the first heartbeat, the value is always greater than zero until the virtual machine is power cycled again. The command returns one of the following values.- 0 – VMware Tools is not installed or not running.
- 1 – Guest operating system is responding normally.
- 5 – Intermittent heartbeat. There might be a problem with the guest operating system.
- 100 – No heartbeat. Guest operating system might have stopped responding.
Note: You usually use the
vmware-cmd
guestinfo option only when VMware Support instructs you to do so. The command is therefore not discussed in this document.