获取相应的挂载点的物理磁盘驱动器与WMI查询? [英] Get corresponding physical disk drives of mountpoints with WMI queries?

查看:226
本文介绍了获取相应的挂载点的物理磁盘驱动器与WMI查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来检索的挂载点(其安装到文件系统,而不是安装一个驱动器号的卷)及其所属的物理磁盘驱动器(S)与WMI?

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 disk drive(s) with WMI?

例如我有被安装到一个W2K8服务器上的卷的挂载点C:\Data\和挂载点被铺展在物理磁盘驱动器2,4,和5这已经得到了一个驱动器的服务器(服务器管理器的数据管理显示),但我不能找到一个办法让这个使用WMI就知道了。

For example I have got a volume mountpoint on a W2K8 server which is mounted to "C:\Data\" and the mountpoint is spreaded on the physical disk drives 2, 4, and 5 of the server (the Data Management of the Server Manager shows that) but I cannot find a way to get this to know by using WMI.

卷信可以使用WMI的类被连接Win32_DiskDrive - > Win32_DiskDriveToDiskPartition - > Win32_DiskPartition - > Win32_LogicalDiskToPartition - >的Win32_LogicalDisk - 但问题是,该卷安装点未在类的Win32_LogicalDisk列出的,它们只在Win32_Volume列出。我没有找到一个方法来连接Win32_Volume与类Win32_DiskDrive类 - ?有缺少一些连接类

Volumes which have got a drive letter can be connected with the WMI-Classes Win32_DiskDrive --> Win32_DiskDriveToDiskPartition --> Win32_DiskPartition --> Win32_LogicalDiskToPartition --> Win32_LogicalDisk – but the problem is, that volume mountpoints aren’t listed in the class Win32_LogicalDisk, they are only listed in Win32_Volume. And I did not find a way to connect the class Win32_Volume with the class Win32_DiskDrive – there are missing some linking classes.

有谁知道一个解决方案

推荐答案

我所知道的是使用Win32 API帮助的唯一途径。

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

打开使用手柄到卷<一HREF =htt​​p://msdn.microsoft.com/en-us/library/aa394515%28VS.85%29.aspx相对=nofollow> Win32_Volume .DeviceID,略作修改。您可以使用格式打开句柄到卷:

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]}

您那么就需要出具的 IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS 检索的 VOLUME_DISK_EXTENTS 结构。这种结构将包含卷的物理磁盘ID列表

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.

使用这些磁盘的ID可以在 Win32_DiskDrive 的.index获得匹配的磁盘。

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

这篇关于获取相应的挂载点的物理磁盘驱动器与WMI查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆