I am developing activation for the system. To generate the request code, I used the hard drive identifier, Bios identifier, and processor identifier. I used the following code to get the hard drive id.
private string getHardDiskID()
{
string hddID = null;
ManagementClass mc = new ManagementClass("Win32_LogicalDisk");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject strt in moc)
{
hddID += Convert.ToString(strt["VolumeSerialNumber"]);
}
return hddID.Trim().ToString();
}
But if I connect a removable drive, the value of this identifier will change. How to get UNIQUE serial number of hard drive ...? Thanks in advance.
source
share