uttamprasad
Enthusiast
Enthusiast

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

Jump to solution

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

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

0 Kudos
10 Replies
aleex42
Enthusiast
Enthusiast

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

0 Kudos
SupreetK
Commander
Commander

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

Cheers,

Supreet

0 Kudos
uttamprasad
Enthusiast
Enthusiast

datastore.PNG

how to get these files in powershell.

0 Kudos
aleex42
Enthusiast
Enthusiast

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

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

datastore1.PNG

I got this error.  Smiley Happy

0 Kudos
planetshoots
Contributor
Contributor

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

0 Kudos
aleex42
Enthusiast
Enthusiast

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

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

datastore16.PNG

i got this output.

it may be directing in the local machine.

0 Kudos
uttamprasad
Enthusiast
Enthusiast

datastore16_1.PNG

is there any way by this method.

0 Kudos
uttamprasad
Enthusiast
Enthusiast

Superb aleex  

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

I got the output what I expected from you.

Thanks aleex.