Linux服务器:


[root@manage ~]# dmidecode -s system-product-name
Alibaba Cloud ECS

[root@manage ~]# lshw -class system
manage.ansible.com          
    description: Computer
    product: Alibaba Cloud ECS
    vendor: Alibaba Cloud
    version: pc-i440fx-2.1
    serial: ca717e64-75b1-45a1-b89f-004d6eb63ec0
    width: 64 bits
    capabilities: smbios-2.8 dmi-2.8 smp vsyscall32
    configuration: boot=normal uuid=647E71CA-B175-A145-B89F-004D6EB63EC0
  *-pnp00:00
       product: PnP device PNP0b00
       physical id: 1
       capabilities: pnp
       configuration: driver=rtc_cmos

[root@manage ~]# dmesg | grep -i virtual
[    0.000000] Booting paravirtualized kernel on KVM
[    0.072025] KVM setup paravirtual spinlock
[    1.195196] input: VirtualPS/2 VMware VMMouse as /devices/platform/i8042/serio1/input/input2
[    1.195515] input: VirtualPS/2 VMware VMMouse as /devices/platform/i8042/serio1/input/input3
[    1.249767] systemd[1]: Detected virtualization kvm.
[    1.346833] systemd[1]: Starting Setup Virtual Console...

Windows服务器:

在CMD里输入:Systeminfo | findstr /i "System Model"
如果System Model:后面含有Virutal就是虚拟机,其他都是物理机
如何判断一台机器是物理机还是虚拟机_第1张图片
如果使用powershell命令:get-wmiobject win32_computersystem | fl model
如何判断一台机器是物理机还是虚拟机_第2张图片