title: Get drive letter from USB mass storage device WIM
body: <p>I have to write a function that returns all drive letters where the drive is a USB stick. The problem is that the USB sticks might be partitioned in way that Windows assigns 2 or more Drives to a single USB stick of which only one is a USB mass storage device(that is the letter that I want). So stuff like
  <code>DriveInfo.GetDrives()</code> and then filtering with <code>device.DriveType == DriveType.Removable</code> does not work because that returns all the drives that are removable.</p>
  <p>I have been trying to do it in WMI but so far I have not found the right answer. The most common answer to similiar questions is to go throug a few classes like this <a href="https://stackoverflow.com/questions/31938686/how-to-get-the-drive-letter-of-usb-device-using-wmi/60548941">(source)</a>:
  <code>Win32_DiskDrive-&gt; Win32_DiskDriveToDiskPartition -&gt; Win32_DiskPartition -&gt; Win32_LogicalDiskToPartition -&gt; Win32_LogicalDisk</code> But that also returns all drives of the USB sticks. My thinking would be to remove all the drives that are not mass storage devices with <code>Win32_USBHub</code>. But I don't know where to add it in the chain or if that is even possible? Any help?</p>