Function IsVirtualMashine() As Boolean
Dim strManufacturer As String
Dim objWMIService As Object
Dim colItems As Object
Dim objItem As Object
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_BaseBoard")
For Each objItem In colItems
strManufacturer = objItem.Manufacturer
Next
IsVirtualMashine = (StrComp(strManufacturer, "Microsoft Corporation", vbTextCompare) = 0) Or _
(StrComp(strManufacturer, "VMWARE", vbTextCompare) = 0)
End Function
|