2

Is there VB6 or VBScript code to detect if running on VMware or Virtual Machines?

The following links show the codes on other programming languages. Is there a way on VB6 or VBScript?

Detect virtualized OS from an application?

How to detect if my application is running in a virtual machine?

Detect if your program is running inside a Virtual Machine

Codename K
  • 694
  • 2
  • 21
  • 46

2 Answers2

2

Vmware have this article about different approaches:

Virtual BIOS DMI information The VMware virtual BIOS has many VMware-specific identifiers which programs can use to detect hypervisors. For the DMI string check, use the BIOS serial number and check for either string "VMware-" or "VMW" (for Mac OS X guests running on Fusion).

Here's a script for accessing the bios serial number:

http://www.vbforums.com/showthread.php?572678-RESOLVED-Getting-CPU-ID-and-BIOS-ID

FloatingKiwi
  • 4,183
  • 1
  • 14
  • 37
2

Confirmed working on Microsoft and VMware.

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")

For Each objItem in colItems
  strModel = objItem.Model
    If InStr(UCase(strModel), "VIRTUAL") Then
      WScript.Echo "VM"
    End If
Next
Randy Schuman
  • 327
  • 1
  • 9