Question

I took the HDD serial number but it did not result in systems using AMD chipset. In the case of computer systems using RAID then how to get HDD serial number?

SelectQuery sq = new SelectQuery("SELECT Tag, SerialNumber FROM Win32_PhysicalMedia"); 

ManagementObjectSearcher searcher = new ManagementObjectSearcher(sq); foreach (var i2 in searcher.Get()) { string Tag = i2["Tag"].ToString();

if (Tag != "\\.\PHYSICALDRIVE0") 

continue;

 string serial = i2["SerialNumber"].ToString();
File.WriteAllText("C:\Caditsys\Serial.txt", serial + Environment.NewLine + DateTime.Now.ToString("dd/MM/yyyy"));
Was it helpful?

Solution

Sometimes its easiest to leverage SmartMonTools. I'm assuming you are using software raid. SmartMonTools will usually tell you the serial number of anything plugged into the motherboard.

smartctl --scan
smartctl -i $yourdevice

If your disks are behind a hardware RAID controller, it gets trickier, but you can still use smartctl with the -d flag specific to your hardware device.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top