Add VMKernel port to several hosts

      No Comments on Add VMKernel port to several hosts

Who likes to configure VMKs on hosts? A couple is totally fine, a few hundreds is not fun!
…We use powercli!!

Code Snippet below:

1..100 | foreach {
$num = $_
New-VMHostNetworkAdapter -VMHost (Get-VMHost "$esx$") -PortGroup Vsan -VirtualSwitch (Get-VDSwitch -name $switchname) -IP "$net$num" -SubnetMask "" -VsanTrafficEnabled $true

In short, i’m giving the esx hostname, while the 1..100 is basically a loop that will complete the ESXI hostname and also the last ip address octet, quite handy isn’t it?
I’m configuring VSAN with non routable IP’s. so obviously this may change in your environments. Adjust at will!

Leave a Reply

Your email address will not be published. Required fields are marked *