Add PortGroup to hosts with PowerCLI

It’s easy to add a new portgroup to all hosts in your cluster or even just one host with PowerCLI.

 

To add to all hosts in the cluster, use this script:

get-cluster “My-Servers” | Get-VMHost | Get-VirtualSwitch -Name “vSwitch2” | New-VirtualPortGroup -Name “VM Mgmt Network VLAN 101” -VLanId 101

 

To add to one host, use this script:

get-vmhost “172.16.101.43” | Get-VirtualSwitch -Name “vSwitch1” | New-VirtualPortGroup -Name “VM Mgmt Network VLAN 101” -VLanId 101

 

That should save you about 90% of the time than using the CLI to add them manually to each host!

powercli

,

No comments yet.

Leave a Reply