Tip: How an app can discover it's running in a virtual machine

Here's a tip from Paul Adare (author of Paul's Digital Lounge and Cigar Bar). If you want an application to discover it's running in a virtual machine, you can do the following:

You could query the registry for the existence of the HKLM\SOFTWARE\Microsoft\Virtual Machine key. Or you could use an WMI query, such as this:

On Error Resume Next

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root
\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32
_BaseBoard",,48)

For Each objItem in colItems

if objitem.Product = "Virtual Machine"