I want to get device id of removable disks. The device id will be like this for example
"GD1125THUS58743"
I can get the device name, but cannot get this type of id.
I want to get device id of removable disks. The device id will be like this for example
"GD1125THUS58743"
I can get the device name, but cannot get this type of id.
Probably, ManagementObjectSearcher
can help you while as DeviceInfo
can provide only name, volume etc. You will need to reference System.Management abd then try:
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();
}