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

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 00:28:36

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

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

How to get mac address

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

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!