3

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

Pranay Rana
  • 175,020
  • 35
  • 237
  • 263
Bibhu
  • 4,053
  • 4
  • 33
  • 63

4 Answers4

3

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();
Pranay Rana
  • 175,020
  • 35
  • 237
  • 263
  • If you clone a hard drive (e.g. using Acronis TrueImage) the drive where copy the image to will have the same volume serial. – bitbonk Jul 08 '11 at 11:07
  • @PranayRana: Is there possible to get unique id of each computer using php? thanks – pcs Aug 01 '15 at 06:06
2

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

How to get mac address

Richard Forrest
  • 3,567
  • 2
  • 23
  • 32
  • 3
    errr ... sorry to disappoint you, but no ... i own 2 NICs with the very same MAC ... was a nice chaos to find the source of some network problems ... the probability for a collision in the same LAN is low ... worldwide, you might be suprised – DarkSquirrel42 Jun 13 '11 at 09:11
  • @DarkSquirrel42 I would saying that trying to unique id pc's on a global level would be a bad idea. If this is a windows app run on a LAN or WAN you could use. – Richard Forrest Jun 13 '11 at 09:18
  • @DarkSquirrel42 You cant have 2 same MAC ids OOTB unless its been tampered. – Zenwalker Jun 13 '11 at 09:23
1

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();
}
Renatas M.
  • 11,694
  • 1
  • 43
  • 62
1

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.

Zenwalker
  • 1,883
  • 1
  • 14
  • 27