Script
-----------------------------------------------------------------------------------------
#Remove all port groups on speific vSwitch#
Add-PSSnapin vmWARE.VimAutomation.Core
Connect-VIServer VCName
$hostserver = "10.194.194.80"
$virtualsw = Get-virtualswitch -vmhost $hostserver -Name vSwitch0
#$vswgoup = Get-VirtualPortGroup -VMHost 10.194.96.1 -VirtualSwitch $virtualsw | where { $_.Name -ne "Management Network" }
$vswgoup = Get-VirtualPortGroup -VirtualSwitch $virtualsw | where { $_.Name -ne "Management Network" }
$vswgoup | Remove-VirtualPortGroup -confirm:$false
Disconnect-VIServer VCName
附件:http://down.51cto.com/data/2366946
本文转自学海无涯博客51CTO博客,原文链接http://blog.51cto.com/549687/1958995如需转载请自行联系原作者
520feng2007