Is there some uniqueID of each computer, to differ

2020-04-16 04:55发布

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

标签: c# unique-id
4条回答
疯言疯语
2楼-- · 2020-04-16 05:23

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();
}
查看更多
一纸荒年 Trace。
3楼-- · 2020-04-16 05:24

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();
查看更多
4楼-- · 2020-04-16 05:25

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

How to get mac address

查看更多
放我归山
5楼-- · 2020-04-16 05:28

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.

查看更多
登录 后发表回答