The Soul of a Virtual Machine

Things to know about running a virtual machine under Virtual Server

Blogs

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

  • Comments 532
  • Likes

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"

Comments
Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment