Get Storage Drives Info for ALL VM's in a Given Cluster

Hello, I am trying to create a script that lists all the virtual machines in a given hyper-v cluster, and it also needs to list the maximum and the current size of the virtual disks that are attached to each virtual machine.

I started by getting this line that lists all the virtual machines in a given cluster -
Get-ClusterGroup -Cluster “myclustername” | Where GroupType –EQ ‘VirtualMachine’ | Get-VM

But unfortunately it does not give me any info about the maximum and the current size of the virtual disks that are attached to each virtual machine.

Can anyone help me here?

Try this

Get-VM | foreach { $VMname = $psitem.Name Get-VMHardDiskDrive -VMName $VMname | foreach { Get-VHD -Path $_.Path | select @{N='VMname'; e={$VMName}}, Path, Size, FileSize } }