public string GetHDDSerialNumber(string drive)
{
//check to see if the user provided a drive letter
//if not default it to "C"
if (drive == "" || drive == null)
{
drive = "C";
}
//create our ManagementObject, passing it the drive letter to the
//DevideID using WQL
System.Management.ManagementObject disk = new System.Management.ManagementObject("win32_logicaldisk.deviceid=\"" + drive + ":\"");
//bind our management object
disk.Get();
//return the serial number
return disk["VolumeSerialNumber"].ToString();
}