6

I'm using this code to get Path,VolumeLabel,TotalSize,FreeSpace:

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

Output:

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

How I can get real path (or maybe drive name) of the mounting point from the Volume GUID ?

enter image description here

I try to use .GetRelated class but with no success. Can somebody help me with this?

ALIENQuake
  • 520
  • 3
  • 12
  • 28
  • http://stackoverflow.com/questions/10186277/how-to-get-drive-information-by-volume-id – Kostia Shiian Feb 19 '15 at 16:02
  • @KostiaShiian I cannot use Win32_Volume or Win32_DiskDrive because I'm using MSCluster_DiskPartition class to get object from cluster perspective. – ALIENQuake Feb 19 '15 at 16:28
  • is this asking for a C# solution? how would powershell play into this? – Ňɏssa Pøngjǣrdenlarp Feb 21 '15 at 18:09
  • 1
    According to [the documentation](https://msdn.microsoft.com/library/aa965286), the class has a `MountPoints` property that is, however, not supported before Windows Server 2012. @ALIENQuake: have you tried getting the `Win32_Volume` regardless and confirmed that it doesn't return information for `MSCluster_DiskPartition` volumes? – Jeroen Mostert Feb 22 '15 at 12:44

1 Answers1

0

I did test it with a vhd file which is mounted at C:\test_vhd\. It seems to work.

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

    Name
    ----
    C:\test_vhd\

enter image description here

hdev
  • 6,097
  • 1
  • 45
  • 62