Is there some uniqueID of each computer, to differentiate one from other?

后端 未结 4 2007
抹茶落季
抹茶落季 2021-01-23 00:15

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

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-23 01:16

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

提交回复
热议问题