How an application can detect if is running inside a Microsoft Virtual PC virtual machine

What if you are a developer and don’t want your application to run in a VM? Or what if you want your application to install (or behave) in a different way when target OS is a virtual one?

Paul Adare, one Virtual PC Most Valuable Professional (MVP), wrote a simple WMI query that verify if you are running on a VM:

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”

Thanks Paul!