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?


2 Answers 2


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:


Get Hardware Model:


Get Hardware Manufacturer:


Results from VM versus on VM

Non VM WMIC Results:

enter image description here

VM WMIC Results:

enter image description here

Further Resources:


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

  • 2
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
    – Tetsujin
    Sep 26, 2016 at 9:45
  • Tetsujin is right there Even though its links to stackoverflow itself the most important part should always be highlighted. Additionally I'm using windows as OS (thus the windows flag) but also ok (maybe even more so if its answers for more than just windows
    – Thomas
    Sep 26, 2016 at 10:25
  • Thanks a lot for the hints! I will dig out the essential part and add to the answer later today. Sep 26, 2016 at 10:26
  • No problem seweryn. still though as those questions and answers are all from 08. Are they still up to the curernt state of technology?
    – Thomas
    Sep 26, 2016 at 10:27
  • On the other SO Exchange I got extreme punishment for summarizing and copying parts of other aswers and I was accused of violation of the "copyright law". So I am not copying any content of other answers. Apr 5, 2017 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.