Also check out the other properties of some of the other WMI classes
(Win32_PhysicalMedia or Win32_DiskDrive), as you might find ID that isn't
related to the logical volume. Not all devices give an asset tag or Serial
number, but you can try. The volume serial is easily changed.
-mike
MVP
Austin Ehlers said:
Hi ALL,
how can I get serial number of harddrive using "pure" .NET, without Win API?
Thanx
using System.Management;
//be sure to reference the System.Managment.dll
string GetSerialNumber(string drive)
{
ManagementObject disk=new
ManagementObject("win32_logicaldisk.deviceid=\"" + drive + ":\"");
return
disk.Properties["VolumeSerialNumber"].Value.ToString());
}