Adding Virtual PortGroups to all ESX Hosts in a Cluster

Connect-VIServer -Server <vCenter Server>
$AllHosts = Get-Cluster <Cluster Name>
foreach ($ESXHost in ($AllHosts | Get-VMHost))
{
 Get-VMHost $ESXHost | Get-VirtualSwitch -Name <vSwitch Number> | New-VirtualPortGroup -Name
<Virtual PortGroup Name> -VLanId <VLan ID>
}
Disconnect-VIServer -Confirm:$false

Related posts:

  1. Adding a Virtual PortGroup to all Hosts
  2. PowerCLI: Reconfiguring NTP Servers on ESX Hosts
  3. PowerCLI: A Simple VM Backup Script
  4. Microsoft NLB Error when trying to Cluster Cloned VM’s
blog comments powered by Disqus
Get Adobe Flash playerPlugin by wpburn.com wordpress themes