I need in my program to tie a license to a hardware ID. I tried use WMI, but it still slow.
I need, for example, CPU, HDD, and motherboard info.
I need in my program to tie a license to a hardware ID. I tried use WMI, but it still slow.
I need, for example, CPU, HDD, and motherboard info.
I got here looking for the same thing and I found another solution. If you guys are interested I share this class:
I won't take any credit for this because I found it here It worked faster than I expected for me. Without the graphic card, mac and drive id's I got the unique ID in about 2-3 seconds. With those above included I got it in about 4-5 seconds.
Note: Add reference to
System.Management
.For more details refer to this link
The following code will give you CPU ID:
namespace required
System.Management
For Hard disk ID and motherboard id details refer this-link
To speed up this procedure, make sure you don't use
SELECT *
, but only select what you really need. UseSELECT *
only during development when you try to find out what you need to use, because then the query will take much longer to complete.Here is a DLL that shows:
* Hard drive ID (unique hardware serial number written in drive's IDE electronic chip)
* Partition ID (volume serial number)
* CPU ID (unique hardware ID)
* CPU vendor
* CPU running speed
* CPU theoretic speed
* Memory Load ( Total memory used in percentage (%) )
* Total Physical ( Total physical memory in bytes )
* Avail Physical ( Physical memory left in bytes )
* Total PageFile ( Total page file in bytes )
* Available PageFile( Page file left in bytes )
* Total Virtual( Total virtual memory in bytes )
* Available Virtual ( Virtual memory left in bytes )
* Bios unique identification numberBiosDate
* Bios unique identification numberBiosVersion
* Bios unique identification numberBiosProductID
* Bios unique identification numberBiosVideo
(text grabbed from original web site)
It works with C#.
The following approach was inspired by this answer to a related (more general) question.
The approach is to read the
MachineGuid
value in registry keyHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography
. This value is generated during OS installation.There are few ways around the uniqueness of the Hardware-ID per machine using this approach. One method is editing the registry value, but this would cause complications on the user's machine afterwards. Another method is to clone a drive image which would copy the
MachineGuid
value.However, no approach is hack-proof and this will certainly be good enough for normal users. On the plus side, this approach is quick performance-wise and simple to implement.