How to determine whether a computer is VM or Physical through VB Script

strComputer = “.”

wscript.echo getMachineType(strComputer)

function GetMachineType(strComputer)
Set objWMIService = GetObject(“winmgmts:” _
& “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2″)

Set colSettings = objWMIService.ExecQuery _
(“Select * from Win32_ComputerSystem”)

For Each objComputer in colSettings
strType = objComputer.Manufacturer
Next
if lcase(left(strType,6))=”vmware” then
GetMachineType=”V” ‘Virtual VMWare Box.
else
GetMachineType=”P” ‘Physical Machine
end if
end function

email me