Quantcast
Channel: VMware Communities : All Content - VMware PowerCLI
Viewing all articles
Browse latest Browse all 16717

finding .iso files in all datastores in vcenter_powercli

$
0
0

Hi Luc ,

if you can check the following

i am looking to check each datasore for .iso file .i dont think there is direct way of doing this .can you please check the folowing script if this works fine ??

 

$datastoresFR=get-datastore

$count=$datastoresFR.count

foreach($d in $datastoresFR)

{

$ds=get-datastore -name $d

for ($i=0; $i -le $count ; $i++)

{

 

New-PSDrive -Location $ds -Name DS[$i] -PSProvider VimDatastore -Root '\' | Out-Null

 

Set-Location DS[$i]:\

$isofile=Get-ChildItem *.iso

if($isofile.count -ge "1")

{

write-host "there are/is .iso files stored in " $ds.name

$isofile

Remove-PSDrive -Name DS[$i] -Confirm:$false

 

}

 

}

 

}


Viewing all articles
Browse latest Browse all 16717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>