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,
To check this from the command prompt you can run this: systeminfo | find "System"
Example output for virtual server:
System Manufacturer: Microsoft Corporation
System Model: Virtual Machine
System Type: x64-based PC
Example output for physical server:
System Manufacturer: HP
System Model: ProLiant BL460c G6
System Type: x64-based PC
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.