【问题标题】:How to convert Volume GUID of the mount point to actual path?如何将挂载点的卷 GUID 转换为实际路径?
【发布时间】:2015-04-20 22:12:42
【问题描述】:

我正在使用此代码获取 Path、VolumeLabel、TotalSize、FreeSpace:

gwmi -ComputerName $ComputerName -namespace root\MSCluster MSCluster_DiskPartition -Credential $cred -Authentication PacketPrivacy | Format-Table Path, VolumeLabel, TotalSize, FreeSpace -AutoSize

输出:

Path                                             VolumeLabel TotalSize FreeSpace
----                                             ----------- --------- ---------
U:                                               Archive1      4194184    379651
\\?\Volume{76795fb2-254e-454d-a95a-739018690cf4} Archive3      4194184    524883
X:                                               Archive2      4194184    735366
\\?\Volume{57e93910-60f9-44b9-8d9d-29d506e1e3d7} Archive4      4194184   1483274

如何从卷 GUID 中获取安装点的真实路径(或驱动器名称)?

我尝试使用 .GetRelated 类但没有成功。有人可以帮我解决这个问题吗?

【问题讨论】:

  • @KostiaShiian 我不能使用 Win32_Volume 或 Win32_DiskDrive 因为我正在使用 MSCluster_DiskPartition 类从集群角度获取对象。
  • 这是要求 C# 解决方案吗? powershell 将如何发挥作用?
  • 根据the documentation,该类具有MountPoints 属性,但在Windows Server 2012 之前不受支持。@ALIENQuake:您是否尝试过获取Win32_Volume 并确认它不返回 MSCluster_DiskPartition 卷的信息?

标签: c# windows powershell failovercluster


【解决方案1】:

我确实使用安装在C:\test_vhd\ 的 vhd 文件对其进行了测试。它似乎有效。

Get-WmiObject -class Win32_Volume -computername localhost | 
    ? { $PSItem.DeviceID.Contains("f91957ea-bb2f-11e4-9464-028037ec0200") } |
    Select-Object Name

    Name
    ----
    C:\test_vhd\

【讨论】:

    猜你喜欢
    • 2011-10-30
    • 1970-01-01
    • 2017-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多