VMware Cloud Community
denjoh44
Enthusiast
Enthusiast

get-vm datastore

how find the datastore for a vm with the datacenter with the command powershell, get-vm, get-datastore, get -datacenter

thanks you for your help

0 Kudos
3 Replies
LucD
Leadership
Leadership

Thread moved to the PowerCLI Community.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
LucD
Leadership
Leadership

I'm not sure, I understand your question fully.

To get the datastore(s) on which a VM is located, you cna do.

Get-VM -Name MyVM | Get-Datastore

To get all the VMs in a datastore and show the datastore(s) they are on

Get-Datacenter -Name MyDC | Get-VM |

Select Name,@{N="Datastore";E={[string]::Join(',',(Get-Datastore -VM $_ | %{$_.Name}))}}

Or did you mean something completely different ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

denjoh44
Enthusiast
Enthusiast

Oh thanks you for this response

0 Kudos