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
Set colItems = objWMIService.ExecQuery(“Select * from Win32
For Each objItem in colItems
if objitem.Product = “Virtual Machine”