我想获取可移动磁盘的设备ID。设备ID将如下所示
" GD1125THUS58743"
我可以获取设备名称,但无法获得此类型的ID。
答案 0 :(得分:0)
可能ManagementObjectSearcher
可以帮助您,而DeviceInfo
只能提供名称,数量等。您需要参考System.Management abd然后尝试:
var query = "Select * from Win32_LogicalDisk where Name='G:'";
ManagementObjectSearcher moSearch = new ManagementObjectSearcher(query);
foreach (var mo in moSearch.Get())
{
//maybe this is ID you are looking for?
mo["VolumeSerialNumber"].ToString();
}