hi try this,
$vm = Get-vm <vmname>
$vhdds = $vm | get-harddisk
foreach($vhdd in $vhdds)
{
$hddlabel = $vhdd.extensionData.DeviceInfo.Label
$hddSize = $vhdd.CapacityGB;
$hddFilePath = $vhdd.FileName
}
this is same as in the links but simpler version, you can print or export the variables as you need.
for FilePath if you only need Datastore,
do
$hddFilePath = $hddFilePath.Split(" ")[0]
hope this helps