Gvckrishna
Contributor
Contributor

Need to know the contents in datastore using powercli or power shell commands

I need to get the contents in a datastore present in our environment , how can i get those using a powershell or powercli commands ?

0 Kudos
1 Reply
LucD
Leadership
Leadership

You can use the VimDatastore PSProvider for that.

$dsName = 'MyDS'

$ds = Get-Datastore -Name $dsName

New-PSDrive -Location $ds -Name DS -PSProvider VimDatastore -Root '' | Out-Null

Get-ChildItem -Path DS:\ -Recurse

Remove-PSDrive -Name DS -Confirm:$false


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

0 Kudos