Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 176483

How much free space

$
0
0

I'm trying to add a line to this script and the line should also show VM's, cluster and how much free and used space on the LUN's. Also I will like the script to give me the name of the datastores.

 

$report = foreach($esx in Get-VMHost){

    foreach($hbaKey in ($esx.Extensiondata.Config.StorageDevice.ScsiTopology.Adapter | where {$_.Adapter -like "*FibreChannelHba*"})){

if($hbaKey.Target){

foreach($tgtKey in $hbaKey.Target){

                foreach($lunKey in $tgtKey.Lun){

$hba = $esx.Extensiondata.Config.StorageDevice.HostBusAdapter | where {$_.Key -eq $hbaKey.Adapter}

$lun = $esx.Extensiondata.Config.StorageDevice.ScsiLun | where {$_.Key -eq $lunKey.ScsiLun}

Select-Object -InputObject $lun -Property @{N="Host";E={$esx.Name}},

@{N="HBA";E={$hba.Device}},

CanonicalName,DisplayName,@{N="LUN";E={$lunKey.Lun}}

                }

            }

        }

    }

}

$report | Export-Csv "C:\temp\lun-report.csv" -NoTypeInformation -UseCulture


Viewing all articles
Browse latest Browse all 176483

Trending Articles