The vmware-checkvm command is part of vmware-tools and allows you to check some vmware properties about your VM.
When run without parameters it returns the software version, from the looks of it, it returns the host major version number. Eg. vSphere 6.5 returns "VMware software version 6 (good)"
What is probably more interesting though is that it also returns if we are running (return value is 0) or not (return value is 1). If VMware tools is installed on a physical host it will return "Not running in a virtual machine." with return value 1.
You can run the command without privileges.
There are also some parameters you can use, but all of them are undocumented.
The following parameters can be used:
- r - return screensize in width x height.
vmware-checkvm -r 1024 768
for a screensize of 1024 pixels wide and 768 pixels heigh.
- p - print out product that it is running on. Not all host types are recognized, known values are:
ESX Server Workstation Unknown
vmware-checkvm -p ESX Server
- h - hardware version, this is the virtual hardware that the virtual machine is running.
vmware-checkvm -h VM's hw version is 4