How do i get the hard disk serial number without using dll and supported by VISTA
+2
A:
Try the code here and let us know if it works.
EDIT: And if that doesn't work, try this code from CodeProject.
Luke Girvin
2009-08-30 13:38:03
+2
A:
This is not c# but I am sure that it's very easy to translate. Here
You should use @Luke one. If it does not work then try this one.
Jonathan Shepherd
2009-08-30 13:39:16
+6
A:
using System.Management;
public string GetHDDSerial()
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");
foreach (ManagementObject wmi_HD in searcher.Get())
{
// get the hardware serial no.
if (wmi_HD["SerialNumber"] != null)
return wmi_HD["SerialNumber"].ToString();
}
return string.Empty;
}
Omar Fernando Pessoa
2010-01-29 13:13:32
Yes, I agree... WMI.
Kris Krause
2010-01-29 13:14:38