Articles → .NET → Get The Hard Disk Serial Number In C#
Get The Hard Disk Serial Number In C#
Code
string harddriveId = string.Empty;
ManagementObjectSearcher mos = new ManagementObjectSearcher("SELECT SerialNumber FROM Win32_DiskDrive");
ManagementObjectCollection moc = mos.Get();
foreach(ManagementObject mo in moc) {
motherBoardId = mo["SerialNumber"].ToString();
}