Categories: PowerShell Scripts

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

Simon Long

Share
Published by
Simon Long

Recent Posts

Google Cloud VMware Engine @ VMworld 2021

Another VMworld is upon us!!! Sadly, it's only virtual again this year. However, that does…

3 years ago

Google Cloud VMware Engine – Learning Resources

As part of my recent move to Google, I'm working on quickly getting up to…

3 years ago

Hey Google!

I am delighted to announce the next chapter in my career. Today is my first…

3 years ago

EP13 – Defending Remotely

In episode thirteen of The VCDX Podcast, I am joined by two special guests who…

3 years ago

Getting Started With Oracle Cloud VMware Solution (OCVS) – Migrating Workloads Using VMware HCX

In my recent ‘Getting started with Oracle Cloud VMware Solution (OVCS)’ post; Getting Started With…

3 years ago

Getting Started With Oracle Cloud VMware Solution (OCVS) – Connecting To An On-Premises Environment

In my recent ‘Getting started with Oracle Cloud VMware Solution (OVCS)’ post; Getting Started With…

3 years ago