none
How to map logical disks to physical disks and partitions in hardware inventory?

    Question

  • I need to query 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

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

    Wednesday, April 05, 2017 11:49 AM

Answers

  • You need to add the WMI class Win32_LogicalDiskToPartition to your hardware inventory.

    Once you have done that, you can use a SQL query similar to this:

    select sd.Name0, ld.DeviceID00, p.DeviceID00 from Logical_Disk_DATA as ld
    join System_DISC as sd on ld.MachineID = sd.ItemKey
    join Partition_DATA as p on ld.MachineID = p.MachineID
    join LOGICAL_DISK_TO_PARTITION_DATA as ld2p on ld.MachineID = ld2p.MAchineID
    where ld2p.Antecedent00 like '%'+p.DeviceID00+'%' and ld2p.Dependent00 like '%'+ld.DeviceID00+'%'

    Wednesday, April 05, 2017 10:50 PM

All replies

  • You need to add the WMI class Win32_LogicalDiskToPartition to your hardware inventory.

    Once you have done that, you can use a SQL query similar to this:

    select sd.Name0, ld.DeviceID00, p.DeviceID00 from Logical_Disk_DATA as ld
    join System_DISC as sd on ld.MachineID = sd.ItemKey
    join Partition_DATA as p on ld.MachineID = p.MachineID
    join LOGICAL_DISK_TO_PARTITION_DATA as ld2p on ld.MachineID = ld2p.MAchineID
    where ld2p.Antecedent00 like '%'+p.DeviceID00+'%' and ld2p.Dependent00 like '%'+ld.DeviceID00+'%'

    Wednesday, April 05, 2017 10:50 PM
  • You need to add the WMI class Win32_LogicalDiskToPartition to your hardware inventory.

    Once you have done that, you can use a SQL query similar to this:

    select sd.Name0, ld.DeviceID00, p.DeviceID00 from Logical_Disk_DATA as ld
    join System_DISC as sd on ld.MachineID = sd.ItemKey
    join Partition_DATA as p on ld.MachineID = p.MachineID
    join LOGICAL_DISK_TO_PARTITION_DATA as ld2p on ld.MachineID = ld2p.MAchineID
    where ld2p.Antecedent00 like '%'+p.DeviceID00+'%' and ld2p.Dependent00 like '%'+ld.DeviceID00+'%'

    Hello,

    How do I add the WMI class Win32_LogicalDiskToPartition to the hardware inventory?

    I tried

    #pragma namespace("\\\\.\\ROOT\\CIMV2") 
    
    //**************************************************************************
    //* Class: Win32_LogicalDiskToPartition
    //* Derived from: CIM_LogicalDiskBasedOnPartition
    //**************************************************************************
    
    [Dynamic, Provider("CIMWin32"), UUID("{8502C4FB-5FBB-11D2-AAC1-006008C78BC7}"), AMENDMENT]
    class Win32_LogicalDiskToPartition : CIM_LogicalDiskBasedOnPartition
    {
      uint64                  EndingAddress;
      uint64                  StartingAddress;
      Win32_DiskPartition REF Antecedent;
      Win32_LogicalDisk   REF Dependent;
    };
    but I could not import the new MOF file even the mofcomp is successful...

    Thanks,

    Dom


    Security / System Center Operations Manager 2012 / System Center Configuration Manager 2012 / SQL System Center Operations Manager 2007 / System Center Configuration Manager 2007 R2 / Forefront Client Security / Forefront Identity Manager

    Thursday, November 09, 2017 1:26 AM
  • On the SCCM Admin Console, open the Properties of the Client Settings. Select Hardware Inventory and then select Set Classes. Then, select Add, and then Connect. Choose the Recursive option. Enable the Win32_LogicalDiskToPartition class.

    Thursday, November 09, 2017 8:33 AM
  • Hello,

    I Enabled Win32_LogicalDiskToPartition class and now I am getting a class more in the resource explorer

    and resource explorer is showing two partitions:

    Is it correct?

    Thanks,

    Dom


    Security / System Center Operations Manager 2012 / System Center Configuration Manager 2012 / SQL System Center Operations Manager 2007 / System Center Configuration Manager 2007 R2 / Forefront Client Security / Forefront Identity Manager


    • Edited by Felyjos Friday, November 10, 2017 1:26 AM
    Friday, November 10, 2017 1:26 AM
  • Disk Partitions are collected by default.

    In your case, if you are interested in Win32_LogicalDiskToPartition, you need the Disk Partitions anyway to make any sense out of Win32_LogicalDiskToPartition.

    Friday, November 10, 2017 1:39 AM
  • Hello,

    I could not find the Win32_DiskDriveToDiskPartition

    On the SCCM Admin Console, open the Properties of the Client Settings. Select Hardware Inventory and then select Set Classes. Then, select Add, and then Connect

    Is it somewhere else?

    Thanks,

    Dom


    Security / System Center Operations Manager 2012 / System Center Configuration Manager 2012 / SQL System Center Operations Manager 2007 / System Center Configuration Manager 2007 R2 / Forefront Client Security / Forefront Identity Manager

    Saturday, November 11, 2017 6:21 AM