Get Virtual Machine list reside on VMware Datastore

Get Virtual Machine list reside on VMware Datastore

Virtual machine  reside on  datastore and you do not care in which cluster they are

(Get-Datastore -Name 'datastore_name').Extensiondata.Vm|%{(Get-View -Id $_.toString()).name}

To find Virtual machines on specific Datastore and specific Cluster

Get-Cluster "your_cluster"|Get-vm |?{($_.extensiondata.config.datastoreurl|%{$_.name})-contains "datastore_name"}
or
Get-Cluster "your_cluster"|Get-vm |?{($_.extensiondata.config.datastoreurl|?{$_.name -eq "datastore_name"})}

Your email address will not be published. Required fields are marked *