Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to tell if the host that a script is running on is a VirtualBox guest VM? Ideally I'm looking for a cross-platform way. I would think this is next to impossible unless, maybe, something in the Guest Additions provides this.

share|improve this question
up vote 2 down vote accepted

Did some poking around and under Linux, dmidecode | less produces:

# dmidecode 2.10
SMBIOS 2.5 present.
5 structures occupying 256 bytes.
Table at 0x000E1000.

Handle 0x0000, DMI type 0, 20 bytes
BIOS Information
        Vendor: innotek GmbH
        Version: VirtualBox

And the Windows equivalent (thanks to Andrew Koester for the pointer)

C:\> wmic bios get smbiosbiosversion

There is a Solaris equivalent, but I can't test it because I only have access to Sparc machines. But, for completeness, here it is: /usr/sbin/smbios

share|improve this answer

In Windows, you can query for the BIOS information with WMI.

I don't believe you're going to find a cross-platform solution, at least without going all the way down and reading it directly out of low-level memory. (In this case, you might be interested in the source code to dmidecode)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .