Possible Duplicates:
Determine when running in a virtual machine
How to detect if my application is running in a virtual machine?
How can I check if Windows is installed on a virtual hard drive (VHD) or a physical drive using C#?
Possible Duplicates:
Determine when running in a virtual machine
How to detect if my application is running in a virtual machine?
How can I check if Windows is installed on a virtual hard drive (VHD) or a physical drive using C#?
If you open a virtual machine file in notepad, you will see it is just an xml file.
It contains information about the operating system, like:
<version>
<guest_os>
<build_number type="string">6.01.7600</build_number>
<long_name type="string">Windows&reg; 7</long_name>
<short_name type="string">Windows&reg; 7</short_name>
<computer_name type="string">Win7-PC.domain.com</computer_name>
</guest_os>
How to check a physical drive? You could check if there is a Windows folder, but that is no guarantee ofcourse.