Hi,
You can achive it using WMI. You will have to add a reference to System.Management.dll (that come with the framework) and then with something like this:
using System.Management; ...
public string GetDiskSerialNumber() { ManagementClass mc = new ManagementClass ( "Win32_LogicalDisk" ) ; ManagementObjectCollection disks = mc.GetInstances( ) ;
foreach ( ManagementObject disk in disks ) { if( disk["Name"] == "C:" ) { return disk ["VolumeSerialNumber"].ToString(); } } return null; }
You can check for other properties of each of the WMI classes on MSDN, just check WMI. Hope it helps,
|