Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

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
SMBIOSBIOSVersion
VirtualBox

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. http://msdn.microsoft.com/en-us/library/aa394077%28VS.85%29.aspx

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.