使用 WMI 查询获取挂载点对应的物理磁盘驱动器?
有没有办法使用 WMI 检索安装点(安装到文件系统而不是安装到驱动器号的卷)与其所属的物理磁盘驱动器之间的连接?
例如,我在 W2K8 服务器上有一个卷安装点,该卷安装点安装到“C:\Data\”,并且安装点分布在服务器的物理磁盘驱动器 2、4 和 5 上(服务器管理器的数据管理)表明)但我找不到使用 WMI 来了解这一点的方法。
具有驱动器号的卷可以与 WMI 类 Win32_DiskDrive 连接 --> Win32_DiskDriveToDiskPartition --> Win32_DiskPartition --> Win32_LogicalDiskToPartition --> Win32_LogicalDisk – 但问题是,卷安装点未在 Win32_LogicalDisk 类中列出,它们仅在 Win32_Volume 中列出。我没有找到将类 Win32_Volume 与类 Win32_DiskDrive 连接的方法 - 缺少一些链接类。
有谁知道解决方案吗?
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?
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.
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.
Does anyone know a solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道的唯一方法是使用 Win32 API 来提供帮助。
您使用<打开卷的句柄 a href="http://msdn.microsoft.com/en-us/library/aa394515%28VS.85%29.aspx" rel="nofollow">Win32_Volume.DeviceID,稍作修改。您可以使用以下格式打开卷的句柄:
然后需要发出 IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS,以检索 VOLUME_DISK_EXTENTS 结构。此结构将包含该卷的物理磁盘 ID 列表。
使用这些磁盘 ID,您可以查询 Win32_DiskDrive.Index 获取匹配的磁盘。
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:
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.