How can i get all USB drives (plugged in)

no9 picture no9 · Jul 27, 2010 · Viewed 15k times · Source

Possible Duplicate:
Get List Of USB Devices

Im making a WPF app.

Im looking for a way to list all plugged in USB devices (disks!) in my comboBox.

I can list all drives using DriveInfo.GetDrives(), but is there a simple way to filter that to USB devices?

thanx

Answer

Ragunathan picture Ragunathan · Jul 27, 2010
 foreach (DriveInfo drive in DriveInfo.GetDrives())
 {
     if (drive.DriveType == DriveType.Removable)
     {
      ..
     }
 }