Remove Virtual Portgroup from Hosts in a Datacenter

Remove Virtual Portgroup from Hosts in a Datacenter

Aug 5, 2011
No Comments Yet

This post describes how to use the following PowerCLI script to remove the specified virtual port group from all hosts in the datacenter.

#Variabels
$Datacenter="Test"
$vSwitch="vSwitch3"
$VirtualPortGroup="Customer1_10.10.10.x"
Get-Datacenter -Name $Datacenter | Get-VMHost | Get-VirtualSwitch -Name $vSwitch |
Get-VirtualPortGroup -Name $VirtualPortGroup | Remove-VirtualPortGroup

PowerCLI asks you to confirm the operation. Be sure that you are removing the right virtual port group.


About the Author

Raymond de Jong

Leave a Reply