每台计算机是否有一些唯一的 ID 来区分一台计算机?

发布于 2024-11-15 07:02:51 字数 109 浏览 10 评论 0原文

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

谢谢, 比布

I am developing a windows application in .NET Framework using C#.I want to know is there any Unique Id of each computer manufactured, let it be manufactured by any manufactrure but it must be unique.

Thanks,
Bibhu

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

复古式 2024-11-22 07:02:51

检查这个:如何获取计算机的唯一 ID

硬盘 ID(卷序列号)< /strong>

寻找独特的卷系列的工作原理非常相似,幸运的是更简单一些:

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

Check this : How to get the Computer's Unique ID

Hard Drive ID (Volume Serial)

Finding a unique volume serial works very similarly and luckily a bit simplier:

ManagementObject dsk = new ManagementObject(@"win32_logicaldisk.deviceid=""" + drive + @":""");
dsk.Get();
string volumeSerial = dsk["VolumeSerialNumber"].ToString();
痞味浪人 2024-11-22 07:02:51

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

如何获取 Mac 地址< /a>

You could get the mac address if its a windows app. This will be unique.

How to get mac address

空心↖ 2024-11-22 07:02:51

您可以使用主板序列号:

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();
}

You can use motherboard serial number:

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();
}
海拔太高太耀眼 2024-11-22 07:02:51

如果它们都位于同一 Windows 网络中,请使用计算机名称。是的,有时它们可​​以具有相同的名称,但为了访问每台 PC,网络将为每台 PC 提供唯一的名称。

Use the computer name if they are all in the same windows network. Yes some times they could have same name, but to get access to each PC, the network will have unique names for each.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文