Reputation: 45
I am trying to list all iso files in ISO directory of a particular datastore in VMware vSphere using powercli. I am able to list all the isos in all the datastores using the below command though but not able to do so for a particular datastore.
dir vmstores:\ -Recurse -Include *.iso | Select Name,FolderPath
Upvotes: 0
Views: 8490
Reputation: 45
I found that the below set of commands worked.
$datastoreName = 'enter_name_of_datastore'
$ds = Get-Datastore -Name $datastoreName
New-PSDrive -Location $ds -Name DS -PSProvider VimDatastore -Root '\' | Out-Null
Get-ChildItem -Path DS:\ISO -Include *.iso -Recurse | Select Name,FolderPath
Remove-PSDrive -Name DS -Confirm:$false
Upvotes: 1
Reputation: 2121
I think you'll need to do something more like:
dir vmstore:\datacentername\datastorename -Recurse -Include *.iso | Select Name, FolderPath
Upvotes: 1