Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 230200

Re: How much free space

$
0
0

It errored out. Below is the original one without the "Used Space Comment" Maybe there was a typo when you made the changes.

 

$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}

$datastore = $esx | Get-Datastore | Where-Object {(%{$_.ExtensionData.Info.Vmfs.Extent} | %{$_.DiskName}) -match $lun.CanonicalName}

Select-Object -InputObject $lun -Property @{N="Cluster";E={Get-Cluster -VMHost $esx | %{$_.Name}}},@{N="Host";E={$esx.Name}},@{N="Datastore";E={$datastore | %{$_.Name}}},@{N="FreeSpace";E={$datastore | %{$_.FreeSpaceGB}}},@{N="Capacity";@{N="Used Space (GB)";E={$datastore | %{$_.CapacityGB}}},@{N="Virtual Machines";E={[string]::Join(",", (Get-VM -Datastore $datastore))}},

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

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

                }

            }

        }

    }

}

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


Viewing all articles
Browse latest Browse all 230200

Trending Articles



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