VMware Cloud Community
jessem
Enthusiast
Enthusiast
Jump to solution

Add new portgroup to entire Cluster

Hello,

Currently, I have the powercli script to add a new portgroup to an existing switch on one host.  I'm looking to see how to do this on an entire cluster given that the vSwitch I want to add it to is the same vSwitch across all hosts.

Get-VMHost -Name ESXI01 | Get-VirtualSwitch -Name vSwitch1 | New-VirtualPortGroup -Name PG400 -VLanId 697

This command works but instead of doing it one host at a time, what is the proper syntax to apply to entire cluster?

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Did you already try something like this ?

Get-Cluster -Name MyCluster | Get-VMHost | Get-VirtualSwitch -Name vSwitch1 | New-VirtualPortGroup -Name PG400 -VLanId 697


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Did you already try something like this ?

Get-Cluster -Name MyCluster | Get-VMHost | Get-VirtualSwitch -Name vSwitch1 | New-VirtualPortGroup -Name PG400 -VLanId 697


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
jessem
Enthusiast
Enthusiast
Jump to solution

yep!  that was it, thx!

0 Kudos