How to check whether the current system is Physical machine(Actual) or Virtual machine
Hi, I want to check whether the current machine is actual OS or is virtual machine through command prompt, plz help me
September 14th, 2012 12:18am

And my questioni is windows specific
Free Windows Admin Tool Kit Click here and download it now
September 14th, 2012 12:19am

Here is the code that you can use to find whether your server is Physical or VMWare box. This code uses Win32_ComputerSystem WMI class to query for Manufacturer property. On Physical servers, this property will give you the name of real manufacturer. While, on Virtual servers, it will give you "VMWare Inc." for VMWare boxes. '---------------------------------------------------------------------------- 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 '-------------------------------------------------------------------------Thanks, Swapnil Prajapati
September 14th, 2012 12:23am

Here is the code that you can use to find whether your server is Physical or VMWare box. This code uses Win32_ComputerSystem WMI class to query for Manufacturer property. On Physical servers, this property will give you the name of real manufacturer. While, on Virtual servers, it will give you "VMWare Inc." for VMWare boxes. '---------------------------------------------------------------------------- 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 '-------------------------------------------------------------------------Thanks, Swapnil Prajapati
Free Windows Admin Tool Kit Click here and download it now
September 14th, 2012 12:30am

Hey thank u vry mch, Is there any way to check this through command prompt? plz reply
September 14th, 2012 1:48am

Hi, You can use powershell command get-wmiobject win32_computersystem | fl modelThanks, Swapnil Prajapati
Free Windows Admin Tool Kit Click here and download it now
September 14th, 2012 2:32am

Hi, You can use powershell command get-wmiobject win32_computersystem | fl model Thanks, Swapnil Prajapati Also you can use command line as Under you command prompt run command WMIC once in WMIC console such as wmic:root\cli> enter following command COMPUTERSYSTEM list Brief /Format:listThanks, Swapnil Prajapati
September 14th, 2012 2:38am

thnk u soooo mch as it was very useful
Free Windows Admin Tool Kit Click here and download it now
September 14th, 2012 4:14am

Hi, (specific to windows OS) The command COMPUTERSYSTEM list Brief /Format:list gives information on Hardware manufacturer, that is not going to help to check whether the operating system is physical or virtual machine. Please let me know if you get any other way to check if the current OS is physical or virtual through command prompt. It is necessary for me to get this information through command prompt. I can check for OS manufacturer info through wmic or systeminfo command to make sure that it is windows OS. What if the virtual machine( ex: VM for Xp) is also manufactured by microsoft only.
September 14th, 2012 6:13am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics