Hi
I get the cluster name to export to a csv file but not the count.
It probably is something silly that i am overlooking.
Code:
$Clusters = Get-Cluster
foreach ($Cluster in $Clusters){
$VMHosts = Get-Cluster $Cluster | Get-VMHost
$TotalBlades = [math]::round(($VMHosts.count.ToString)) |
Select-Object @{N="Cluster";E={$Cluster.Name}},@{N="BladeCount";E={$TotalBlades}} |
Export-csv Blade-Count.csv -NoTypeInformation
}
Thanks
Found this one liner that does the trick:
Get-Cluster | Select Name, @{N="BladeCount";E={@($_ | Get-VMHost).Count}} | Export-Csv Blade-Count.csv -NoTypeInformation
Found this one liner that does the trick:
Get-Cluster | Select Name, @{N="BladeCount";E={@($_ | Get-VMHost).Count}} | Export-Csv Blade-Count.csv -NoTypeInformation
Yea was going to say just change "$TotalBlades = [math]::round(($VMHosts.count.ToString))" to "$TotalBlades = $VMHosts.count".