Get corresponding physical disk drives of mountpoints with WMI queries?

后端 未结 1 1146
别那么骄傲
别那么骄傲 2021-01-13 01:17

Is there a way to retrieve a connection between a mountpoint (a volume which is mounted into the file system instead of mounted to a drive letter) and its belonging physical

相关标签:
1条回答
  • 2021-01-13 01:24

    The only way I know of is using the Win32 API to help.

    You open a handle to the volume using Win32_Volume.DeviceID, modified slightly. You can open a handle to the volume using the format:

    \\.\Volume{[GUID]}
    

    You then need to issue IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS on the open handle to retrieve a VOLUME_DISK_EXTENTS structure. This structure will contain a list of physical disk ids for the volume.

    Using these disk ids you can query WMI on Win32_DiskDrive.Index to get the matching disk.

    0 讨论(0)
提交回复
热议问题