Take a look at the answer to this very similar question:VMware PowerCLI Forum - VMware {code}
Quote:
$DatastoreCluster="MyDatastoreClusterName"
$DSClusterView = Get-View -ViewType StoragePod -Filter @{"Name"="^$DatastoreCluster$"} -Property Name,ChildEntity $DSCDatastores = Get-View -Id $DSClusterView.ChildEntity -Property Name,Host
# Show all hosts that have this datastore mounted:
foreach($ds in $DSCDatastores){
Get-View -Id $ds.Host.Key -Property Name |
Select @{N='DSC';E={$DatastoreCluster}},
@{N='Datastore';E={$ds.Name}},
@{N='VMHost';E={$_.Name}}
}
Please let me know if that's something you were looking for.
Cheers,
Paul Wilk