I borrowed this script from another thread, it was created by LucD. I cannot get the following line to show me the cluster name for the datastore, I know I am missing something, I just don't know what. The report shows every other row, but for cluster it is just blank. The script is pulling all datastores that are less than 20% free space and converting that data to an HTML file for reporting purpose.
@{N='Cluster';E={$_.Cluster.Name}},
&{foreach($vc in $global:DefaultVIServers){
Get-Datastore | ? {($_.name -like "LUN*" -or $_.Name -like "iSCSI*") -and ($_.Name -notlike "*LOG*)} |
where {($_.FreeSpaceGB/$_.CapacityGB) -le 0.20} |
Select @{N='vCenter';E={$vc.Name}},
@{N='Cluster';E={$_.cl.Name}},
@{N='FreespaceGB';E={[math]::Round($_.FreespaceGB,2)}},
@{N='Freespace%';E={[math]::Round($_.FreespaceGB/$_.CapacityGB*100,1)}}},
}
ConvertTo-HTML -CssUri "pathtomycssfile" | Out-File c:\temp\datastore_report.html
Appreciate the help!