computer systems using the AMD chipset and RAID how to get the HDD serial number?

StackOverflow https://stackoverflow.com/questions/21248462

  •  30-09-2022
  •  | 
  •  

Вопрос

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"));
Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top