Retrieving Virtual Machine Attributes
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.
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 is esx (VMware ESX), embeddedESX (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 is win32-x86 (x86-based Windows system), linux-x86 (x86-based Linux system), or vmnix-x86 (x86-based ESXi microkernel).
The getproductinfo build, getproductinfo majorversion, or getproductinfo 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:
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.