title: How to get drive information by volume id
body: <p>I have a txt file with volume id's in it.</p>
  
  <p>I need to get drive info (drive letter, drive size, etc.) from the drive volume id (Windows):</p>
  
  <p>the volume id is in the following format:</p>
  
  <pre><code>\\?\Volume{XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
  </code></pre>
  
  <p>The drive can be Removable/local disk</p>
  
  <p>It doesn't matter how the info is retrieved (it could be script, cpp ,c#, java code).</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I tried to use DriveInfo, Win32_LogicalDisk, Win32_Volume, Win32_PnpDevices - but I couldn't find this weird id... in all cases the id has a differrent format</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Found out how to do it.</p>
  
  <p>you can enumerate Win32_Volume like this:</p>
  
  <pre><code>ManagementObjectSearcher ms = new ManagementObjectSearcher("Select * from Win32_Volume");    
  foreach(ManagementObject mo in ms.Get())   
  {
      var guid = mo["DeviceID"].ToString();
  
      if(guid == myGuid)
          return mo["DriveLetter"];
  }
  </code></pre>