Script
----------------------------------------------------------------------------------
Add-PSSnapin vmWARE.VimAutomation.Core
$vc="devvc55"
connect-viserver $vc
$date = Get-Date -Format 'yyyyMMdd'
$VLANinfo = foreach ($cluster in get-cluster)
{
foreach ($esx in (Get-VMHost -Location $cluster))
{
foreach ($pg in (Get-VirtualPortGroup -VMHost $esx))
{
Select-Object -InputObject $pg -Property @{N="Cluster"; E={$cluster.Name}},
@{N="VMhost"; E={$esx.Name}},
@{N="VirtualSwitchName"; E={$pg.VirtualSwitchName}},
@{N="portgroup"; E={$pg.Name}},
@{N="VLAN"; E={$pg.VlanID}}
}
}
}
$VLANinfo | Export-Csv "C:\PS\report\$($vc)_allPortGroup_$date.csv"
附件:http://down.51cto.com/data/2366943
本文转自学海无涯博客51CTO博客,原文链接http://blog.51cto.com/549687/1958980如需转载请自行联系原作者
520feng2007