How to map logical disks to physical disks and partitions in SCCM

disk-volumepartitionsccmwmi

I need to query System Center Configuration Manager (current branch, version 1606) for information about the disks, partitions and volumes of client computers.

However, there doesn't seem to be any way to correlate logical disks to physical disks and partitions; those data are presented as three different classes in the Resource Explorer, and even the corresponding database tables and views provide no way to link a logical disk to a physical disk and a partition (while instead a partition can at least be linked to its physical disk).

Unfortunately, this seems to be a well known issue in Windows systems, quite hard to get around even when using WMI:
https://blogs.technet.microsoft.com/heyscriptingguy/2005/05/23/how-can-i-correlate-logical-drives-and-physical-disks
https://stackoverflow.com/questions/4822559/powershell-and-wmi-how-to-map-logical-disk-volumes-to-a-hard-disk-or-vice-versa

Can this really be so hard? Is it possible at all to retrieve from SCCM a list of logical disks and the physical disks and partitions where they reside?

Best Answer

SCCM doesn not retrieve this information on its own, but there is a WMI class exposing it: Win32_LogicalDiskToPartition.

The class needs to be added to SCCM's hardware inventory Configuration; after the data are retrieved, it becomes possible to use them to join logical disks to physical partitions; some string manipulation is required, because the class exposes partitions and disks in the following format:

\\HOSTNAME\root\cimv2:Win32_DiskPartition.DeviceID="Disk #0, Partition #0"
\\HOSTNAME\root\cimv2:Win32_LogicalDisk.DeviceID="C:"