I found this on one of your replies, LucD. I don't really need the details for each vmhost as per cluster was good enough. I guess I didn't do enough sleuthing before I posted. Get-Datacenter -...
See more...
I found this on one of your replies, LucD. I don't really need the details for each vmhost as per cluster was good enough. I guess I didn't do enough sleuthing before I posted. Get-Datacenter -PipelineVariable dc | Get-Cluster -PipelineVariable cluster | Get-VMHost | Get-VirtualPortGroup | Select @{N = 'Datacenter'; E = {$dc.Name}}, @{N = 'Cluster'; E = {$cluster.Name}}, Name, VlanId, @{N = 'VMCount'; E = {($_ | Get-VM).Count}} | Group-Object -Property Datacenter, Cluster, Name | ForEach-Object -Process { $_ | Select @{N = 'Datacenter'; E = {$_.Name.Split(',')[0].Trim(' ')}}, @{N = 'Cluster'; E = {$_.Name.Split(',')[1].Trim(' ')}}, @{N = 'Portgroup'; E = {$_.Name.Split(',')[2].Trim(' ')}}, @{N = 'VlanId'; E = {$_.Group[0].VlanId}}, @{N = 'VMHostCount'; E = {$_.Count}}, @{N = 'VMCount'; E = {($_.Group | Measure-Object -Property VMCount -Sum).Sum}} }