Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Unique System Identifiers in C#

what kind of 'unique' system identifiers can be easily obtained using C# (to hash and then uniquely identify a system)? I could just hash HDD size and things like that but I need to identify and distinguish computers that are all built by the same components so I can't go by that.

Appreciate hints, ideas, sample code!

like image 406
Alex Avatar asked Aug 20 '09 21:08

Alex


3 Answers

Here's a good start with WMI ...

// Win32_CPU will work too
var search = new ManagementObjectSearcher( "SELECT * FROM Win32_baseboard" );
var mobos = search.Get();

foreach (var m in mobos)
{
  var serial = m["SerialNumber"]; // ProcessorID if you use Win32_CPU
}

You can do that with many pieces of hardware and come up with a solution.

like image 159
JP Alioto Avatar answered Oct 14 '22 19:10

JP Alioto


You can use the System.Management namespace to get all stuff related to the hardware, ProcessorId, MAC addresses, and a lot more info you can then hash together.

Take a look at this article:

http://www.codeproject.com/KB/system/GetHardwareInformation.aspx

like image 8
Vinko Vrsalovic Avatar answered Oct 14 '22 20:10

Vinko Vrsalovic


Presuming you are talking about Windows, then each Windows installation has a unique product id (which you can see when you view the properties of My Computer). I think this is stored in HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion:ProductId(REG_SZ). I take it you want more than that?

like image 6
Dan Diplo Avatar answered Oct 14 '22 21:10

Dan Diplo