Most desktops run this perfectly, but when it runs on a newly configured desktop like 7th generation clone pc, the whole application closes with an error stating it can not read HDD. But why? I use .net 4.5.
var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
foreach (ManagementObject wmi_HD in searcher.Get())
{
string SerialNo = wmi_HD.GetPropertyValue("Signature").ToString();
if (SerialNo == "0" || SerialNo == "" || SerialNo == null)
{
}
else
{
hdCollection.Add(SerialNo);
}
}