I've come to a dead-end I appreciate your help. I am running my .Net C# app on windows 7 OS on a VM and want my C# code to determine whether I'm running on a vmware VM or a physical host. Right now I am doing something that works, I am looking at the serial number of the machine and by default vmware prefixes it with the string "VMware". But I feel like this is not reliable since someone could change the serial number or the prefix. Another way is to look at the prefix of the nic's MAC address which starts with vmware unique numbers, but this might also be customized by the admins.
Do you know of any sure-way to determine I'm running on a vmware virtual machine?
Thanks.
You could enumerate the hardware components and check for VMware "hardware".
André
You could check bit 31 of CPUID[1].ECX (the HYPERVISOR bit), or you could check for the presence of the VMware backdoor port (0x5658).
Thank you Andre and jmattson. I will try your alternatives as well.
For now this is what I did: the command prompt "systeminfo" got a bunch of good stuff. The System Manufacturer would say "VMware, Inc." and System Model would say "VMware Virtual Platform". I am using these to determine whether I am a VM or not.
Oops! ~ I just realized that checking the system model is not a good idea because the way I'm doing it now (checking if the returned string contains the word "virtual") works only in English. On a localized system like German or French this may not work. I thought I was on to something simple, but I guess I will have to explore new ways of determining this that is language-independent as you recommended in your answers above.