Try something like this
foreach($clusterinGet-Cluster){
foreach($esxinGet-VMHost-Location$cluster){
Get-VirtualSwitch-VMHost$esx|
Select@{N="Cluster";E={$cluster.Name}},
@{N="ESXi";E={$esx.Name}},
@{N="vSwitch";E={$_.Name}},
@{N="Portgroups";E={[string]::Join(',',Get-VirtualPortGroup-VirtualSwitch$_|%{$_.Name})}}
}
}