check if Running OS is physical or virtual


hi,

please let me know if other way check if current os physical or virtual through command prompt. necessary me this information through command prompt.

i can check os manufacturer info through wmic or systeminfo command make sure windows os. what if virtual machine( ex: vm xp)  is also manufactured microsoft only.

write in notepad:

strcomputer = "computername"
set objwmiservice = getobject("winmgmts:\\" & strcomputer & "\root\cimv2")
set colitems = objwmiservice.execquery("select * win32_computersystem",,48)

each objitem in colitems
strmodel = objitem.model
if strmodel = "virtual machine" then
wscript.echo "this virtual machine!"
else
wscript.echo "this not virtual machine"
end if
next

save vm.vbs

then go in cmd , write cscript "location of .vbs"

that's all!


marco adamo



Windows Server  >  Windows Server General Forum



Comments

Popular posts from this blog

WIMMount (HSM) causing cluster storage to go redirected (2012r2 DC)

Failed to delete the test record dcdiag-test-record in zone test.com

Azure MFA with Azure AD and RDS