How can I detect (.NET or Win32) if my application is running in a virtual machine?
+5
A:
Here is an example of one way to do it. It only works with Microsoft's Virtual PC and VMWare, but it's a start: http://www.codeproject.com/KB/system/VmDetect.aspx
Arthur Chaparyan
2009-01-31 06:06:02
That is very interesting... seeing how the machines reacts to using invalid assembly commands. Awesome!
Jason
2009-01-31 06:08:14
I searched "detect if running in virtual machine" (without the quotes) in Google and it was the first result.
Arthur Chaparyan
2009-01-31 06:08:34
Actually the best way is "hardware fingerprinting":http://blogs.msdn.com/virtual_pc_guy/archive/2005/10/27/484479.aspx
Arthur Chaparyan
2009-01-31 06:09:12
+6
A:
According to Virtual PC Guy's blog post "Detecting Microsoft virtual machines", you can use WMI to check the manufacturer of the motherboard. In PowerShell:
(gwmi Win32_BaseBoard).Manufacturer -eq "Microsoft Corporation"
Jay Bazuzi
2009-01-31 06:15:55