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