-3

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.

JleruOHeP
  • 10,106
  • 3
  • 45
  • 71
  • 1
    Where did your researches lead you so far ? – ChoiBedal Aug 25 '14 at 10:02
  • once i inserted dongle, there will be an unique id for that removable disk. i want to get that device(dongle) id in c#. – Karthick Aug 25 '14 at 10:15
  • What I meant was that StackOverflow users aren't there to give a fully fonctionnaly code to whoever ask. Users are here to help other developers to get rid of problems they meet. Since you haven't provided any work you've done, I don't think people will help you. But still I think this might help you : http://stackoverflow.com/questions/1124463/how-to-get-the-list-of-removable-disk-in-c?rq=1 – ChoiBedal Aug 25 '14 at 10:22
  • Yes. above link helps to get device name and other properties by using deviceinfo class. in this type, am not getting device id. but i installed dongel, am getting that device id. i want that id without installing dongle application in my system. Anyhow, Thanks for helping me.. – Karthick Aug 25 '14 at 10:26

1 Answers1

0

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();
}
JleruOHeP
  • 10,106
  • 3
  • 45
  • 71
  • No. Thats PNPDeviceID. but without install, causes error. after installing dongle, the PNPDeviceID generates that what am looking for. my question is that without installing, can we get that? Thanks... – Karthick Aug 25 '14 at 10:38
  • 1
    Are you asking of "how to get the removable device ID without plugging it"? – JleruOHeP Aug 25 '14 at 10:42
  • No. if i plugging it, the device id is not getting. after plugging it and installed that, the device id is generating. did u got?? – Karthick Aug 25 '14 at 11:00
  • I am sorry but no. What do you need to install to get the device id? – JleruOHeP Aug 25 '14 at 11:20
  • No. my question is that can read device(unique)id if i insert usb on removable disk? – Karthick Aug 25 '14 at 12:18