我尝试找到一个唯一的ID,该ID与虚拟机和主机相同。
我尝试使用监视器ID,BIOS编号,但它们可以针对不同的最终用户重复。
using (ManagementObjectSearcher monitorSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_DesktopMonitor"))
{
foreach (ManagementObject monitor in monitorSearcher.Get())
{
String MonitorName = monitor["Name"].ToString();
String MonitorId = monitor["DeviceId"].ToString();
Console.WriteLine("Monitor name: {0}", MonitorName);
Console.WriteLine("Monitor id: {0}", MonitorId);
}
}
ManagementClass managementClass = new ManagementClass("Win32_BIOS");
ManagementObjectCollection instances = managementClass.GetInstances();
foreach (ManagementBaseObject instance in instances)
{
string version = instance.Properties["SMBIOSBIOSVersion"].Value.ToString();
Console.WriteLine("The version is :" + version.ToString());
}
我阅读了很多东西,浏览了各种主题和论坛,但是我在哪里找不到信息,或者根本不可能吗?也许至少有一个序列号可以在主机以及虚拟机上重复出现?