Pages: [1]
Print
Author Topic: list all portgroups on vmhost  (Read 252 times)
esarakaitis
Administrator
Full Member
*****
Posts: 241


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« on: June 02, 2009, 09:21:47 AM »

Code:
foreach ($vmhost in get-vmhost) {
$HostView = Get-View $vmhost.ID
$NetworkSystem = get-view $HostView.ConfigManager.NetworkSystem
$AllPortGroups = $NetworkSystem.NetworkInfo.Portgroup | where {$_.Spec.VlanId -gt 0 }
foreach ($HostPortGroup in $AllPortGroups){
"" | select @{Name = "Name"; Expression = {$vmhost.name}}, @{Name = "VLAN"; Expression = {$HostPortGroup.Spec.Name}}
}
}
Logged
Pages: [1]
Print
Jump to: