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();
}



Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, August 13, 2019

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250