VMware Cloud Community
uttamprasad
Enthusiast
Enthusiast
Jump to solution

How to get the VM files of its folder in datastore in powershell

Is there any scripts of powershell  to get the all file details of vm like vmx,vmdk,snapshots,log files and other files.

1 Solution

Accepted Solutions
aleex42
Enthusiast
Enthusiast
Jump to solution

Play around with:

dir -Recurse -Path datastore:\ -Include *vmname* | select Name,DatastoreFullPath

Hope to help Smiley Happy

-- Alex (VMware VCAP-DCV, NetApp NCIE, LPIC 2)

View solution in original post

Reply
0 Kudos
10 Replies
aleex42
Enthusiast
Enthusiast
Jump to solution

Play around with:

dir -Recurse -Path datastore:\ -Include *vmname* | select Name,DatastoreFullPath

Hope to help Smiley Happy

-- Alex (VMware VCAP-DCV, NetApp NCIE, LPIC 2)
Reply
0 Kudos
SupreetK
Commander
Commander
Jump to solution

What details are you looking for? Can you please elaborate? Do you want it in any specific format?

Cheers,

Supreet

Reply
0 Kudos
uttamprasad
Enthusiast
Enthusiast
Jump to solution

datastore.PNG

how to get these files in powershell.

Reply
0 Kudos
aleex42
Enthusiast
Enthusiast
Jump to solution

Try my example with "sles12sp3" instead of vmname Smiley Happy

-- Alex (VMware VCAP-DCV, NetApp NCIE, LPIC 2)
Reply
0 Kudos
uttamprasad
Enthusiast
Enthusiast
Jump to solution

datastore1.PNG

I got this error.  Smiley Happy

Reply
0 Kudos
planetshoots
Contributor
Contributor
Jump to solution

I think you can use RVTools for this to get the report

Reply
0 Kudos
aleex42
Enthusiast
Enthusiast
Jump to solution

Your datastore is named "datastore16" not "datastore" as in my example Smiley Happy

-- Alex (VMware VCAP-DCV, NetApp NCIE, LPIC 2)
uttamprasad
Enthusiast
Enthusiast
Jump to solution

datastore16.PNG

i got this output.

it may be directing in the local machine.

Reply
0 Kudos
uttamprasad
Enthusiast
Enthusiast
Jump to solution

datastore16_1.PNG

is there any way by this method.

Reply
0 Kudos
uttamprasad
Enthusiast
Enthusiast
Jump to solution

Superb aleex  

Dir vmstores:\ip@portno\ha-datacenter\datastore16\  | select-object name

I got the output what I expected from you.

Thanks aleex.