Jump to content


How to determine is a machine is physical or virtual.

Recommended Posts

Hi All,


I have a perfectly working TS for deploying OSD on physical machines. What I am trying to achieve is to use the same TS and branch out if the condition is true:


IsVM equal to TRUE

or a WMI query:



I have tried both the options but they do not work, please let me know if I am making a mistake.



SCCM 2007 R3

Windows 7 deployment on a VMware platform.

Virtual machine will be created using HW template using vCenter (which I don not care about).

Share this post

Link to post
Share on other sites

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
if lcase(left(strType,6))="vmware" then
GetMachineType="V" 'Virtual VMWare Box.
GetMachineType="P" 'Physical Machine
end if
end function

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...