I'm trying to correlate volumes (as enumerated from win32_volume
for those where DriveType = 3
) back to win32_physicaldisk
instances. Everything that I've seen in my research points to the answer being "it's not possible", but then again, I didn't read the entire Internet. :) I'm currently getting the information out of diskpart, but am running into limitations with that approach.
As a bonus, if the answer is "no, and here's the reason why", that would be useful, too.
This doesn't necessarily answer the wmi question but here's an alternative. Use a diskpart script and parse out the results.
Create a diskpart script like so:
Execute the diskpart script from powershell (or something to parse out the results):
This will grab all the volumes associated with disk 3 and output the capture group from the regex match to show each volume number. You can add additional capture groups to grab information like the label, file system type, and more.
Unfortunately this isn't a remote method and may not suit your needs, but still may be useful to know.
You sohuld use:
and
Can also be used to query remote computers for this information.
This isn't specifically volumes->disks, but you could pipe the partitions in to Get-Disk. For example, this will tell you the disk associated with drive letter C:
(Tested on PS version 5.1)