0

I'm struggling to understand how to link the information of logical drives (C:, D:\ etc) is on which physical drive (HDD, SATA, NVMe etc).

I'm able to pull the information separately using ManagementObject queries of both MSFT_PhysicalDisk and Win32_LogicalDisk classes but combining the two accurately is proven a real head scratcher.

A quick google threw up that I needed to use Win32_DiskDriveToDiskPartition and Win32_LogicalDiskToPartition classes but reading them just made my head hurt more. Any help would be appreciated but I'm basically after a way to show both class information side by side accurately:

ie:

  • C:\ is an SSD
  • D:\ is an NVMe
  • E:\ is an HDD

Cheers!

SammyJ
  • 25
  • 6
  • There is no way to achieve output shown as desired and "accurately" - letters not necessary map to disks/partitions and disks/partitions not necessary map to letters... – Alexei Levenkov May 03 '22 at 23:35
  • Did you try code from https://devblogs.microsoft.com/scripting/how-can-i-correlate-logical-drives-and-physical-disks/ – Chetan May 03 '22 at 23:55
  • See `Win32_DiskDrive -> Win32_DiskDriveToDiskPartition -> CIM_LogicalDiskBasedOnPartition` associator queries here: [Get the serial number of USB storage devices in .Net Core 2.1](https://stackoverflow.com/a/51806262/7444103) (not just about a *Serial Number*) and here: [WMI Association of LogicalDisk with DiskPartition](https://stackoverflow.com/a/48119922/7444103) – Jimi May 04 '22 at 01:41

0 Answers0