Get-Datacenter "CG-SO" | Get-Cluster|Get-VMHost |Get-VirtualPortGroup tells me the virtualportgroups and vlans.
NPR--10.1.202.0_24 key-vim.host.PortGroup-NPR-... 202
NPR--10.1.201.0_24 key-vim.host.PortGroup-NPR-... 201
NPR--10.1.113.0_24 key-vim.host.PortGroup-NPR-... 113
NPR--10.1.106.0_24 key-vim.host.PortGroup-NPR-... 106
I can get host and vm counts with the following:
Get-Cluster | Select Name, @{N="Host Count"; E={($_ | Get-VMHost).Count}}, @{N="VM Count"; E={($_ | Get-VM).Count}}
How do I combine the two to get the following?
Cluster VirtualPortGroup Vlan VMhost Count VM Count
CG-SO-PRE-DMZ-WINDOWS NPR--10.1.106.0_24 106 3 50
I want to identify those virtual port groups no longer in use to evaluate if they need to be removed. We've had several vlans removed from our network infrastructure over the years.