Get the appropriate physical disks with mount points with WMI requests?

Is there a way to get the connection between the mount point (the one that is mounted in the file system instead of the drive attached to the letter) and the physical disk with WMI that belongs to it?

For example, I have a mount point for a volume on a W2K8 server that is mounted on "C: \ Data", and the mount point extends to the physical disks 2, 4 and 5 of the server (Server Manager shows this for data management), but I cannot find a way Learn about it using WMI.

The volumes that received the drive letter may be associated with the Win32_DiskDrive → Win32_DiskDriveToDiskPartition → Win32_DiskPartition → Win32_LogicalDiskToPartition → Win32_LogicalDisk WMI classes, but the problem is that the mountpoints arent listed in the Win32_Logical class only. And I did not find a way to connect the Win32_Volume class to the Win32_DiskDrive class - some link classes are missing.

Does anyone know a solution?

+6
c # wmi
source share
2 answers

The only way I know is to use the Win32 API.

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

\\.\Volume{[GUID]} 

Then you need to release IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS in the opened handle to get VOLUME_DISK_EXTENTS . This structure will contain a list of physical disk identifiers for the volume.

Using these drive identifiers, you can query WMI on Win32_DiskDrive .Index to get the appropriate drive.

+2
source share

This is similar to my question: is there a Win32_MountPoint and Win32_Volume in Windows XP?

In the code example (in C #), I am connecting between the Win32_Volume class and the Win32_MountPoint class.

0
source share

All Articles