In a VI Client I can go to the Configuration page of an ESX host and under Networking see the count and names of all VMs attached to a port group.
How can a similar report be generated via PowerShell?
Try adapting my example here ( http://www.peetersonline.nl/index.php/vmware/how-many-vms-in-each-lan/ ) for use on a single esx host. You could also connect to the esx server instead of to the VC server.
You can try this
$esxName = <esxname> $pgName = <portgroup-name> $vms = Get-VMHost -Name $esxName | Get-VM $number = $vms | %{Get-VirtualPortGroup -VM $_ -Name $pgName} | Measure-Object | %{$_.Count} $guests = $vms | %{if(Get-VirtualPortGroup -VM $_ -Name $pgName) {$_.Name}} Write-Host $number $guests
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference