VMware Cloud Community
nava_thulasi39

How to find the Datastore for a VM by powercli

Hi,

How to find the Datastore name for a VM by powercli. Currently the VM shows as Orphaned VM in the vCenter. So i need to check the Datastore name where the VM resides?

Thanks in advance.

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
3 Replies
Ather_Beg
Enthusiast
Enthusiast

How about get-vm <VM Name> | get-datastore ?

nava_thulasi39

Hi,

Thanks for the quick reply.

That's right. That gives the result.

But VM folder or files doesn't exist in the Datastore. So is there any way to to find the VM folder name or vmdk file for this VM in the entire datastore.?

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
Ather_Beg
Enthusiast
Enthusiast

Well, I hope the VM hasn't been deleted accidentally.  Try "get-datastore -VM <VM Name> -refresh".  I believe it should look at all known datastores and list the ones that contain this VM.

0 Kudos