using System;
using System.Collections.Generic;
using System.Linq;
using System.Management;
using System.Text;
using System.Threading.Tasks;
class Info
{
//另一种获取C盘序列号的方式
public string GetDiskIDByC()
{
try
{
String HDid = "";
ManagementObject mo = new ManagementObject("win32_logicaldisk.deviceid=\"c:\"");
if (mo != null)
{
//HDid = (string)mo.Properties["Model"].Value;
//HDid = mo.Properties["SerialNumber"].Value.ToString();
HDid = mo.Properties["VolumeSerialNumber"].Value.ToString();
}
return HDid;
}
catch (Exception ex)
{
return "unknow";
}
finally { }
}
}