This script will connect to your vcenter, and iterate through every host in the cluster. Just make sure to set the parameters highlighted in yellow correctly.
connect-viserver VCENTER
$Cluster = "Cluster01"
$vSwitch = "vSwitch0"
$NPG = "PORT-GROUP-NAME"
$VLAN = "VLAN-NUMBER"
Get-Cluster -Name $Cluster | Get-VMHost | foreach { New-VirtualPortGroup -VirtualSwitch ( Get-VirtualSwitch -Name $vSwitch -VMHost $_ ) -Name $NPG -VLanId $vlan }
No comments:
Post a Comment