How to find DiskIndex of a Volume or Mount point using Powershell

I am using Win32_Volume wmi class to report the Mount points and drive letters and labels etc…

Get-WmiObject Win32_Volume | FT Caption,Label,FreeSpace,Capacity

How to add DiskIndex to my report?

I get DiskIndex using Win32_DiskPartition, but not able to map it with the result from my first command(Get-WmiObject Win32_Volume).

Get-WmiObject Win32_DiskPartition | FT DiskIndex

PS : I cannot use Win32_LogicalDisk class as it will not report the mount points…

Just to make sure I understand what you’re trying to do. You want to get the physical disk number that a mount point is on, hence trying to match something from Win32_DiskPartition to something in Win32_Volume… so you can return the DiskIndex value from Win32_DiskPartition and make that part of your report along with the drive letter, path, etc…

Correct? If so, i’m trying to find something that could be used between the two classes that would be able to match to ensure you’re getting correct data. But nothing is jumping out at me.


Actually, It doesn’t appear there is any WMI methods of matching physical disk to mount point. Someone wrote something to do it, but it’s not using WMI to get the disk index. They wrote their own class and it requires powershell remoting in order to get the data.


I know you can run “diskpart” in POSH and then execute the “list disk” command which will output the index numbers of all volumes on the host. You should be able to do the same with PS remoting.

Thanks I will try Get-MountPointData Cmdlet and see if it works for me…

I think diskpart doesn’t show the drive letters or the mount points information. It only shows the disk index.