List Volume GUIDs by Disk

Windows Server 2016 Backup says it wants to back up a volume that has no letter. What volume is it? What disk(s) is that volume on?

Windows Server 2016 Backup selection 1

Mountvol lists GUIDs of mounted volumes and their drive letters, but that doesn’t help identify the disk it’s on if the volume doesn’t have a letter.

This PowerShell command, adapted from this thread, lists GUIDs and space but still doesn’t tell me which disk the volumes are on:

Get-WMIObject win32_volume | Format-List -property Label,DriveLetter,DeviceID,SystemVolume,Capacity,Freespace

This command, adapted from this answer, gives the drive number as well:

Get-WMIObject Win32_LogicalDisk | Foreach-Object {
Get-WmiObject -Query "Associators of {Win32_LogicalDisk.DeviceID='$($_.DeviceID)'} WHERE ResultRole=Antecedent"

However note that it omits volumes without drive letters due to the parent/child association on “DeviceID”.

This post has the following code:

$diskdrive = gwmi win32_diskdrive
foreach($drive in $diskdrive)
	"`nDrive: DeviceID: $($drive.deviceid.substring(4)) - Model: $($drive.model)"
	$partitions = gwmi -Query "ASSOCIATORS OF {Win32_DiskDrive.DeviceID=`"$($drive.DeviceID.replace('\','\\'))`"} WHERE AssocClass = Win32_DiskDriveToDiskPartition"
	foreach($part in $partitions)
		"`tPartition: $($"
		$vols = gwmi -Query "ASSOCIATORS OF {Win32_DiskPartition.DeviceID=`"$($part.DeviceID)`"} WHERE AssocClass = Win32_LogicalDiskToPartition"
		foreach($vol in $vols)

This one does show the partitions that don’t have drive letters, but no details are listed, again because “volumes” (actually logical disks) are retreived by the associated DeviceID.

Another post builds on that but it looks like that would also not list volume GUIDs.

In the end, I went with a modified version of the first command, showing Capacity and FreeSpace in MB. That allowed me to find the partition by “eyeballing” it in diskmgmt.msc.

Get-WMIObject win32_volume | Format-List -property Label,DriveLetter,DeviceID,SystemVolume,
@{Name="Capacity MB";Expression={[math]::truncate($_.Capacity / 1MB)}},
@{Name="Freespace MB";Expression={[math]::truncate($_.Freespace / 1MB)}}

I saw that Windows Server 2016 Backup was showing the 450MB Recovery partition as not having a drive letter. But it also lists a Recovery partition with a name. Inspecting the contents, they are not the same:

Windows Server 2016 Backup selection 2

No doubt this is because, after an in-place upgrade of Server 2012 R2 to 2016, I now have two recovery partitions, one 300MB and one 450MB. This article explains how get back to only one partition, but for now I’ll just back them both up

2 thoughts on “List Volume GUIDs by Disk

  1. Geoff Duke

    The Storage module was added to PowerShell in Windows 8/2012, and contains the commands Get-Disk, Get-Partition, and Get-Volume, which might also be useful. []

  2. Mark Berry Post author

    Thanks Geoff. Those commands do look like they would be easier to work with than the WMI commands. However, I’m still not seeing a link between disks and volumes. Are you? I was hoping that Get-Volume would have a property returning an array of DiskNumbers, which would map back to values in Get-Partition and Get-Disk. Similarly, Get-Disk and Get-Partition could have arrays of partitions and volumes, respectively.

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.

This site uses Akismet to reduce spam. Learn how your comment data is processed.