是否每台计算机都有一些uniqueID,以区分一台计算机和另一台计算机

本文关键字:计算机 一台 uniqueID 是否 | 更新日期: 2023-09-27 17:59:04

我正在使用C#在.NET Framework中开发一个windows应用程序。我想知道制造的每台计算机是否有唯一Id,让任何制造商制造它,但它必须是唯一的。

谢谢,Bibhu

是否每台计算机都有一些uniqueID,以区分一台计算机和另一台计算机

检查此项:如何获取计算机的唯一ID

硬盘驱动器ID(卷序列号)

找到一个独特的卷序列的工作原理非常相似,幸运的是简化了一点:

ManagementObject dsk = new ManagementObject(@"win32_logicaldisk.deviceid=""" + drive + @":""");
dsk.Get();
string volumeSerial = dsk["VolumeSerialNumber"].ToString();

如果是windows应用程序,您可以获得mac地址。这将是独一无二的。

如何获取mac地址

您可以使用主板序列号:

public static string GetMBSN()
{
   //Getting list of motherboards
   ManagementObjectCollection mbCol = new ManagementClass("Win32_BaseBoard").GetInstances();
   //Enumerating the list
   ManagementObjectCollection.ManagementObjectEnumerator mbEnum = mbCol.GetEnumerator();
   //Move the cursor to the first element of the list (and most probably the only one)
   mbEnum.MoveNext();
   //Getting the serial number of that specific motherboard
   return ((ManagementObject)(mbEnum.Current)).Properties["SerialNumber"].Value.ToString();
}

如果它们都在同一个windows网络中,请使用计算机名。是的,有时它们可能有相同的名称,但为了访问每台电脑,网络将为每台电脑提供唯一的名称。