VMware Cloud Community
MRoushdy
Hot Shot
Hot Shot

get VMDK file locations

Hello,

I'd like to get a specific VM, and list it's VMDKs, and where they are stored (datastore name).

Thanks,

vEXPERT - VCAP-DCV - Blog: arabitnetwork.com | YouTube: youtube.com/c/MohamedRoushdy
4 Replies
LucD
Leadership
Leadership

Something like this?

$vmName = 'MyVM'

Get-VM -Name $vmName |

Get-HardDisk |

Select Name,FileName,@{N='Datastore';E={$_.FileName.Split(']')[0].TrimStart('[')}}


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

Reply
0 Kudos
MRoushdy
Hot Shot
Hot Shot

Hello,

Thanks but, I've found that the following command gets the exact result I needed:

get-vm VMNAME | get-harddisk

vEXPERT - VCAP-DCV - Blog: arabitnetwork.com | YouTube: youtube.com/c/MohamedRoushdy
Reply
0 Kudos
LucD
Leadership
Leadership

Excuse me, but that is basically the same as I gave you.
My snippet gives exactly what you asked (the datastore)


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

MRoushdy
Hot Shot
Hot Shot

Dear,

You will always be our PowerCLi Guru and Savior.

Good day,

vEXPERT - VCAP-DCV - Blog: arabitnetwork.com | YouTube: youtube.com/c/MohamedRoushdy
Reply
0 Kudos