.netwinapivirtualization

How to detect if my application is running in a virtual machine?


How can I detect (.NET or Win32) if my application is running in a virtual machine?


Solution

  • 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"