【问题标题】:Is there some uniqueID of each computer, to differentiate one from other?每台计算机是否有一些唯一ID,以区分其他计算机?
【发布时间】:2011-09-13 18:45:28
【问题描述】:

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

谢谢, 比布

【问题讨论】:

    标签: c# unique-id


    【解决方案1】:

    检查这个:How to get the Computer's Unique ID

    硬盘 ID(批量序列号)

    寻找一个独特的连续剧的工作非常相似,幸运的是更简单:

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

    【讨论】:

    • 如果您克隆硬盘驱动器(例如使用 Acronis TrueImage),则复制图像的驱动器将具有相同的卷序列号。
    • @PranayRana:是否有可能使用 php 获取每台计算机的唯一 ID?谢谢
    【解决方案2】:

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

    How to get mac address

    【讨论】:

    • errr ... 很抱歉让您失望了,但没有... 我拥有 2 个具有相同 MAC 的 NIC ... 找到一些网络问题的根源是一个很好的混乱...在同一个 LAN 中发生冲突的可能性很低......在全球范围内,您可能会感到惊讶
    • @DarkSquirrel42 我想说尝试在全球范围内唯一标识 pc 将是一个坏主意。如果这是在 LAN 或 WAN 上运行的 Windows 应用程序,您可以使用。
    • @DarkSquirrel42 除非被篡改,否则您不能拥有 2 个相同的 MAC id OOTB。
    【解决方案3】:

    您可以使用主板序列号:

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

    【讨论】:

    • 对于某些主板,WMI 不返回序列号。
    【解决方案4】:

    如果它们都在同一个 windows 网络中,则使用计算机名称。是的,有时它们可​​能具有相同的名称,但要访问每台 PC,网络将为每台 PC 设置唯一的名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-29
      • 2011-03-17
      • 1970-01-01
      • 2012-11-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-05
      相关资源
      最近更新 更多