• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2161
  • Last Modified:

Need a powercli command to list all contents of a datastore

I need a powercli command that will list the contents of a datastore the same way you can choose "browse datastore" from the vsphere gui. In other words something that will list random folders that are not necessarily VMs.
0
Thaidog
Asked:
Thaidog
1 Solution
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
PowerCLI gives this ability based on the Powershell provider concept. This mean that VMware datastores can be browsed with the native Powershell commandlets like Set-Location, Get-Item, Get-ChildItem and their aliases like cd, ls, dir. PowerCLI datastore provider also allows to manipulate datastore contents with native Powershell commandlets like Copy-Item, Move-Item, Remove-Item, etc.

this example will list all files and subfolders that starts with WinXP
inside the datastore with name Storage1.

ls vmstores:\myServer@443\Datacenter\Storage1\WinXP*

Open in new window

0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Tackle projects and never again get stuck behind a technical roadblock.
Join Now