You can use the following approach to get a Volume or DriveLetter on which a disk partition is mounted.
- Win32_LogicalDiskToPartition
- Win32_DiskDrive
From the Win32_DiskDrive class Win32_DiskDrive you can get DriveNumber by querying the Index property or retrieving the DriveNumber from Name attribute. Then run the Antecedent and Dependent request from Win32_LogicalDiskToPartition . For Antecedent you get the disk number and the partition in which it tries to display the volume, then extract the DriveLetter , for example, "C:", "D:", etc. From the Dependent property. Thus, using this logic, you can set LogicalDrives to a specific HardDisk . I use this logic in my component to get the LogicalDrive names ("C:", "D:", etc.) for a specific hard drive on my system.
source share