How to check my windows server is virtual machine or physical machine

后端 未结 8 1295
谎友^
谎友^ 2020-12-31 09:45

I\'m remoting desktop to windows servers in our Lab/datacenter. I have a requirement to figure out all our servers are virtual machines or physical servers programatically,

8条回答
  •  粉色の甜心
    2020-12-31 10:09

    Try this:

    FOR /F "tokens=*" %a IN ('wmic bios get bioscharacteristics^|find /c "33"') DO set USBlegacy=%a
    

    This returns "1" for the limited range of desktops and laptops in my environment and "0" for VMWare workstation 9, ESX 5.5, and Citrix 6.5 and 7.6. BIOSCharacteristic "50" (one "reserved for system vendor") I've only found in the four virtual environments so that would work in reverse.

    Edit: or there's this:

    FOR /F "tokens=*" %a IN ('wmic path win32_pnpentity get ^|find /c "ACPI Fan"') DO set ACPIfan=%a
    

    Returns "5" on an HP Desktop, "0" on VMware workstation 9 and ESX 5.5, not tested on the others.

提交回复
热议问题