10

Time and again I've seen security programs where the description says "Please don't try to run this inside a VM, as the program will not be able to be started" or "The security program will say that it is not in a valid environment if run from a VM".

What I'm wondering here is: How can the programs detect if they are within a VM or not? Is there some flag somewhere that is set, or is it specific drivers?

Thomas
  • 495

2 Answers2

8

How can I detect if I'm within a vm or not?

A quick way I've done this in the past is by using WMIC commands from the command prompt to query WMI name space objects for computer, make, model, and serial numbers.

You could program some logic to use WMIC results as part of the install process and if it detects something known you could make it check this as part of the logic indicating it's a VM, or perhaps you program it to find other values saying it is not a VM or both.


Get Hardware Serial Number:

WMIC BIOS GET SERIALNUMBER

Get Hardware Model:

WMIC COMPUTERSYSTEM GET MODEL

Get Hardware Manufacturer:

WMIC COMPUTERSYSTEM GET MANUFACTURER

Results from VM versus on VM

Non VM WMIC Results:

enter image description here

VM WMIC Results:

enter image description here


Further Resources:

Thomas
  • 495
2

The topic was higlighted couple of times. Here are some hints dependig on OS: