i have tried using the code
searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");
int i = 0;
foreach (ManagementObject wmi_HD in searcher.Get())
{
// get the hard drive from collection
// using index
HardDrive hd = (HardDrive)hdCollection[i];
// get the hardware serial no.
if (wmi_HD["SerialNumber"] == null)
hd.SerialNo = "None";
else
hd.SerialNo = wmi_HD["SerialNumber"].ToString();
++i;
}

Suthish NairRank #92 · 22.8K reputationPosted Jul 28, 2016, 10:32 PM EDT
Apurba RanjanRank #4,352 · 349 reputationPosted Jul 28, 2016, 11:12 PM EDT