How to detect if my application is running in a vi

2019-01-07 09:55发布

How can I detect (.NET or Win32) if my application is running in a virtual machine?

9条回答
小情绪 Triste *
2楼-- · 2019-01-07 10:39

Here is an example of one way to do it. It only works with Microsoft's Virtual PC and VMWare, but it's a start: http://www.codeproject.com/KB/system/VmDetect.aspx

查看更多
聊天终结者
3楼-- · 2019-01-07 10:43

According to Virtual PC Guy's blog post "Detecting Microsoft virtual machines", you can use WMI to check the manufacturer of the motherboard. In PowerShell:

 (gwmi Win32_BaseBoard).Manufacturer -eq "Microsoft Corporation"
查看更多
冷血范
4楼-- · 2019-01-07 10:43

The easiest way I found to figure out whether my C# app is running on a vmware VM or not is to check the MAC address of the NIC card(s). If it's a VMware VM it would always be: 00:50:56:XX:YY:ZZ

You may enumerate through the NICs as resolved here.

查看更多
登录 后发表回答