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

后端 未结 8 1324
谎友^
谎友^ 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 09:48

    There is no easy way to tell if you're running in a bare metal or in a virtual computer, the best thing you can do is to get some hardware info and made an educated guess, for example, if the machine have a network adapter which contains Microsoft, VMware, Oracle, Hyper-V, Virtual or VirtualBox, most likely it's a virtual machine given that neither Microsoft, Oracle, or VMware fabricate network cards.

    As you use C#, the class for retrieving this and other hardware info is ManagementClass, also there is this nice project that let you retrieve tons of info from your computer using ManagementClass.

提交回复
热议问题